package net.xiduth.game.player;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;

import net.xiduth.Settings;
import net.xiduth.cores.CoresManager;
import net.xiduth.game.Animation;
import net.xiduth.game.CustomisedShop;
import net.xiduth.game.Entity;
import net.xiduth.game.ForceTalk;
import net.xiduth.game.Graphics;
import net.xiduth.game.Hit;
import net.xiduth.game.Hit.HitLook;
import net.xiduth.game.World;
import net.xiduth.game.WorldObject;
import net.xiduth.game.WorldTile;
import net.xiduth.game.item.FloorItem;
import net.xiduth.game.item.Item;
import net.xiduth.game.item.ItemsContainer;
import net.xiduth.game.minigames.PestControl;
import net.xiduth.game.minigames.clanwars.FfaZone;
import net.xiduth.game.minigames.clanwars.WarControler;
import net.xiduth.game.minigames.duel.DuelArena;
import net.xiduth.game.minigames.duel.DuelRules;
import net.xiduth.game.minigames.recipe.RFD;
import net.xiduth.game.npc.NPC;
import net.xiduth.game.npc.familiar.Familiar;
import net.xiduth.game.npc.godwars.zaros.Nex;
import net.xiduth.game.npc.pet.Pet;
import net.xiduth.game.player.actions.Farming;
import net.xiduth.game.player.combat.PlayerCombat;
import net.xiduth.game.player.content.CrystalChest;
import net.xiduth.game.player.content.FadingScreen;
import net.xiduth.game.player.content.FriendChatsManager;
import net.xiduth.game.player.content.Lottery;
import net.xiduth.game.player.content.Magic;
import net.xiduth.game.player.content.Notes;
import net.xiduth.game.player.content.Pots;
import net.xiduth.game.player.content.ShootingStar;
import net.xiduth.game.player.content.SkillCapeCustomizer;
import net.xiduth.game.player.content.SlayerTask;
import net.xiduth.game.player.content.botanybay.BotanyBay;
import net.xiduth.game.player.content.cannon.DwarfCannon;
import net.xiduth.game.player.content.cannon.GoldDwarfCannon;
import net.xiduth.game.player.content.cannon.RoyaleDwarfCannon;
import net.xiduth.game.player.content.construction.House;
import net.xiduth.game.player.content.construction.Room;
import net.xiduth.game.player.content.construction.RoomConstruction;
import net.xiduth.game.player.content.construction.RoomReference;
import net.xiduth.game.player.content.events.SquealOfFortune;
import net.xiduth.game.player.content.events.interfaces.XiduthManagement;
import net.xiduth.game.player.content.exchange.ItemOffer;
import net.xiduth.game.player.content.exchange.ItemOffer.OfferType;
import net.xiduth.game.player.content.grandexchange.GrandExchange;
import net.xiduth.game.player.content.grandexchange.GrandExchangeOffer;
import net.xiduth.game.player.content.pet.PetManager;
import net.xiduth.game.player.content.transportation.LocationCrystal;
import net.xiduth.game.player.controlers.CorpBeastControler;
import net.xiduth.game.player.controlers.CrucibleControler;
import net.xiduth.game.player.controlers.DTControler;
import net.xiduth.game.player.controlers.FightCaves;
import net.xiduth.game.player.controlers.FightKiln;
import net.xiduth.game.player.controlers.GodWars;
import net.xiduth.game.player.controlers.HouseControler;
import net.xiduth.game.player.controlers.NomadsRequiem;
import net.xiduth.game.player.controlers.QueenBlackDragonController;
import net.xiduth.game.player.controlers.Wilderness;
import net.xiduth.game.player.controlers.ZGDControler;
import net.xiduth.game.player.controlers.castlewars.CastleWarsPlaying;
import net.xiduth.game.player.controlers.castlewars.CastleWarsWaiting;
import net.xiduth.game.player.controlers.dung.RuneDungGame;
import net.xiduth.game.player.controlers.fightpits.FightPitsArena;
import net.xiduth.game.tasks.WorldTask;
import net.xiduth.game.tasks.WorldTasksManager;
import net.xiduth.net.Session;
import net.xiduth.net.decoders.WorldPacketsDecoder;
import net.xiduth.net.decoders.handlers.ButtonHandler;
import net.xiduth.net.encoders.WorldPacketsEncoder;
import net.xiduth.utils.ChatColors;
import net.xiduth.utils.IsaacKeyPair;
import net.xiduth.utils.Logger;
import net.xiduth.utils.MachineInformation;
import net.xiduth.utils.Misc;
import net.xiduth.utils.PkRank;
import net.xiduth.utils.SerializableFilesManager;
import net.xiduth.utils.ShopsHandler;
import net.xiduth.utils.Utils;
import net.xiduth.utils.player.LogsManager;

public class Player extends Entity {

	public static final int TELE_MOVE_TYPE = 127, WALK_MOVE_TYPE = 1,
			RUN_MOVE_TYPE = 2;
	private static final long serialVersionUID = 2011932556974180375L;

	/**
	 * 
	 * DIS.
	 * 
	 */

	private transient long disDelay;
	private transient Clanchat clanChat;
	private String clanChatOwner;
	private int clanChatSetup; 
	
	//stronghold stuff
	
	public boolean finishedFloor1, finishedFloor2, finishedFloor3, finishedFloor4, 
	usedChest1, usedChest2, usedChest3, usedChest4;
	
	public boolean hasBossCReq;
	
	public boolean talkedToBob, completedLostRing;
	
	/**
	 * 
	 * Lootshare.
	 * 
	 */

	private boolean lootshareEnabled;
	
	/**
	 * Money vault.
	 */

	public long count;

	public static String FormatNumber(long count) {
		return new DecimalFormat("#,###,##0").format(count).toString();
	}
	
	// Godwars
	public int ArmadylKC;
	public int BandosKC;
	public int SaradominKC;
	public int ZamorakKC;

	/**
	 * Lost city.
	 */

	public int lostCity = 0;

	public boolean spokeToWarrior = false;
	public boolean spokeToShamus = false;
	public boolean spokeToMonk = false;
	public boolean recievedRunes = false;

	/**
	 * Rank System
	 */

	public int rankpoints;
	public int ranks;
	public boolean ranked = false;
	public boolean privatee;
	public boolean specialist;
	public boolean corporal;
	public boolean sergeant;
	public boolean lieutenant;
	public boolean captain;
	public boolean major;
	public boolean colonel; // end here
	public boolean brigadierGeneral = false;
	public boolean commander = false;

	/**
	 * Task System
	 */

	public boolean ToggleSystem;
	public boolean SystemED = false;
	public int CookingTask;
	public int GemTask;
	public int RestTask;
	public int FletchingTask;
	public boolean CompletedTasks;
	public int bandos;
	public int AgilityBonus;

	/**
	 * Trusted Rank
	 */

	private boolean isTrusted;

	public boolean isTrusted() {
		return isTrusted;
	}

	public void setTrusted(boolean isTrusted) {
		this.isTrusted = isTrusted;
	}

	/**
	 * Staff System
	 */

	public int staffpin = 59059;

	public boolean hasStaffPin;

	/**
	 * Yell System
	 */

	private String yellPrefix = "Player";
	private String yellShade = "";

	/**
	 * Bank pins.
	 */

	public boolean hasBankPin;
	public boolean hasEnteredPin;
	public int pin;

	public int getBankPin() {
		return pin;
	}

	public void setBankPin(int pin) {
		this.pin = pin;
	}

	/**
	 * Dwarf Cannon quest
	 */

	public int fixedRailings = 0;
	public boolean fixedRailing1 = false;
	public boolean fixedRailing2 = false;
	public boolean fixedRailing3 = false;
	public boolean fixedRailing4 = false;
	public boolean fixedRailing5 = false;
	public boolean fixedRailing6 = false;

	public boolean completedRailingTask = false;
	public boolean spokeToNu = false;
	public boolean completedDwarfCannonQuest = false;

	/**
	 * 
	 * NPC point storing.
	 * 
	 */

	public int fdragonkills;

	public void setfdragonkills(int fdragonkills) {
		this.fdragonkills = fdragonkills;
	}

	public void addfdragonkills() {
		fdragonkills += 1;
	}

	public int getfdragonkills() {
		return fdragonkills;
	}

	public boolean hasAcceptAid() {
		return acceptAid;
	}
	public final static boolean isAtBoss(WorldTile tile) {// TODO fix this
		return (tile.getX() >= 1599 && tile.getX() <= 1675
				&& tile.getY() >= 5242 && tile.getY() <= 5316);
	}
	public static void climbCliff(final Player player, WorldObject object) {
		player.setNextAnimation(new Animation(3378));
		final WorldTile toTile = new WorldTile(2995, 3935, 0);

		player.getPackets().sendGameMessage("You climb up the rock.", true);
		WorldTasksManager.schedule(new WorldTask() {
			@Override
			public void run() {
				player.setNextWorldTile(toTile);
			}

		}, 6);
	}

	public void pickNeemVine(final WorldObject object) {
		lock();
		WorldTasksManager.schedule(new WorldTask() {
			// 15457
			private int count;

			@Override
			public void run() {
				if (count++ == 1) {
					setNextFaceWorldTile(new WorldTile(object.getX(), object
							.getY(), object.getPlane()));
					if (!getInventory().containsItem(1935, 1)) {
						out("You need a jug to get neem oil", 0);
						return;
					}
					if (Utils.random(0) > 1)
						out("You manage to get some need oil", 0);
					getInventory().addItem(22444, 1);
					setNextAnimation(new Animation(15460));
					unlock();
					stop();
				}
				count++;
			}

		}, 1, 0);
		unlock();
	}

	public void climbUpPolyporeVine(final WorldObject object, final int locX,
			final int locY, final int plane) {
		lock();
		WorldTasksManager.schedule(new WorldTask() {
			// 15457
			private int count;

			@Override
			public void run() {
				if (count == 0) {
					setNextFaceWorldTile(new WorldTile(object.getX(), object
							.getY(), object.getPlane()));
					setNextAnimation(new Animation(15456));
					unlock();
				} else if (count == 2) {
					setNextWorldTile(new WorldTile(locX, locY, plane));
					setNextAnimation(new Animation(-1));
				} else if (count == 3.5) {
					unlock();
					stop();
				}
				count++;
			}

		}, 1, 0);
	}

	public void climbPolyporeVine(final WorldObject object, final int locX,
			final int locY, final int plane) {
		lock();
		WorldTasksManager.schedule(new WorldTask() {
			// 15457
			private int count;

			@Override
			public void run() {
				if (count == 0) {
					setNextFaceWorldTile(new WorldTile(object.getX(), object
							.getY(), object.getPlane()));
					setNextAnimation(new Animation(15458));
					unlock();
				} else if (count == 2) {
					setNextWorldTile(new WorldTile(locX, locY, plane));
					setNextAnimation(new Animation(15459));
				} else if (count == 3) {
					unlock();
					stop();
				}
				count++;
			}

		}, 1, 0);
	}

	public void jumpGap(final WorldObject object, final int locX,
			final int locY, final int plane) {
		if (getSkills().getLevel(Skills.AGILITY) < 73) {
			getDialogueManager().startDialogue("Agile");
			getPackets().sendGameMessage(
					"You need an agility level of 73 to use this shortcut.");
			return;
		}
		lock();
		setNextFaceWorldTile(new WorldTile(object.getX(), object.getY(),
				object.getPlane()));
		WorldTasksManager.schedule(new WorldTask() {
			// 15457
			private int count;

			@Override
			public void run() {
				if (count == 0) {
					setNextFaceWorldTile(new WorldTile(object.getX(), object
							.getY(), object.getPlane()));
					setNextAnimation(new Animation(15461));
					unlock();
				} else if (count == 4) {
					setNextWorldTile(new WorldTile(locX, locY, plane));
					setNextAnimation(new Animation(15459));
				} else if (count == 5) {
					unlock();
					stop();
				}
				count++;
			}

		}, 1, 0);

	}

	/**
	 * Toolbelt
	 */
	public boolean rake = false;
	public boolean spade = false;
	public boolean pick = false;

	/**
	 * Farming
	 */

	// Falador
	private int faladorHerbPatch;
	private int faladorNorthAllotmentPatch;
	private int faladorSouthAllotmentPatch;
	private int faladorFlowerPatch;
	private boolean faladorHerbPatchRaked;
	private boolean faladorNorthAllotmentPatchRaked;
	private boolean faladorSouthAllotmentPatchRaked;
	private boolean faladorFlowerPatchRaked;

	// Catherby
	private int catherbyHerbPatch;
	private int catherbyNorthAllotmentPatch;
	private int catherbySouthAllotmentPatch;
	private int catherbyFlowerPatch;
	private boolean catherbyHerbPatchRaked;
	private boolean catherbyNorthAllotmentPatchRaked;
	private boolean catherbySouthAllotmentPatchRaked;
	private boolean catherbyFlowerPatchRaked;

	public int lividpoints;
	public int getHomeX;
	public int getHomeY;
	public boolean lividcraft;
	public boolean lividfarming;
	public boolean lividmagic;
	public int agilityPoints;
	public int element;

	public void addagilityPoints() {
		agilityPoints += 4;
	}

	public boolean lividfarm;

	public boolean fire;

	public boolean ice;

	public boolean god;

	// trivia shit
	public int triviaPointss = 0;

	public void addTriviaPoints() {
		triviaPointss += 1;
	}

	// voting points
	public int votePointss = 0;

	public void addVotePoints() {
		votePointss += 1;
	}

	/**
	 * 
	 * Skilling stuff.
	 * 
	 */

	// woodcutting

	public int logscut;

	public void addlogscut() {
		logscut += 1;
	}

	public int getlogscut() {
		return logscut;
	}

	// skills

	public int skillpoints;

	public void addskillpoints() {
		skillpoints += 1;
	}

	public int getskillpoints() {
		return skillpoints;
	}

	public void setskillpoints(int skillpoints) {
		this.skillpoints = skillpoints;
	}

	// mining

	public int oresmined;

	public void addoresmined() {
		oresmined += 1;
	}

	public int getoresmined() {
		return oresmined;
	}

	// fishing

	public int fishfished;

	public void addfishfished() {
		fishfished += 1;
	}

	public int getfishfished() {
		return fishfished;
	}

	// cooking

	public int cooked;

	public void addcooked() {
		cooked += 1;
	}

	public int getcooked() {
		return cooked;
	}

	// Ardougne
	private int ardougneHerbPatch;
	private int ardougneNorthAllotmentPatch;
	private int ardougneSouthAllotmentPatch;
	private int ardougneFlowerPatch;
	private boolean ardougneHerbPatchRaked;
	private boolean ardougneNorthAllotmentPatchRaked;
	private boolean ardougneSouthAllotmentPatchRaked;
	private boolean ardougneFlowerPatchRaked;

	// Canifis
	private int canifisHerbPatch;
	private int canifisNorthAllotmentPatch;
	private int canifisSouthAllotmentPatch;
	private int canifisFlowerPatch;
	private boolean canifisHerbPatchRaked;
	private boolean canifisNorthAllotmentPatchRaked;
	private boolean canifisSouthAllotmentPatchRaked;
	private boolean canifisFlowerPatchRaked;

	// Lumbridge
	private int lummyTreePatch;
	private boolean lummyTreePatchRaked;

	// Varrock
	private int varrockTreePatch;
	private boolean varrockTreePatchRaked;

	// Falador
	private int faladorTreePatch;
	private boolean faladorTreePatchRaked;

	// Taverly
	private int taverlyTreePatch;
	private boolean taverlyTreePatchRaked;

	// Tutorials

	private boolean isCook;
	public boolean hasDoneCook;

	private boolean isSkillsTutorial;
	public boolean hasDoneSkillsTutorial;

	private boolean isCombatTutorial;
	public boolean hasDoneCombatTutorial;

	/**
	 * Squeal of Fortune
	 */

	public static ItemsContainer<Item> items = new ItemsContainer<Item>(13,
			true);
	public int Rewards;
	public int spins;

	public void refreshSqueal() {
		getPackets().sendConfigByFile(11026, getSpins());
	}

	/**
	 * Troll Invasion
	 */

	private int trollPoints;
	public boolean trollReward;
	private int trollsToKill;
	private int trollsKilled;

	/**
	 * 
	 * Dungeoneering.
	 * 
	 */

	private int DungTokens;

	private int PvMPoints;

	public int KillStreak = 0;

	// saved location

	public int playerSavedX, playerSavedY, playerSavedZ;

	/**
	 * Lottery pot total.
	 */
	public static int LOTTERY_TOTAL = 0;

	/**
	 * Lodestone Activating
	 */

	/**
	 * 
	 * DT Points.
	 * 
	 */

	private int DP;

	/**
	 * 
	 * Glacors
	 * 
	 */
	private int GlacorFreeze;
	private boolean GlacorFree;

	public boolean activatedBurthorpeLodestone = true;
	public boolean activatedLunarIsleLodestone = true;
	public boolean activatedBanditCampLodestone = true;
	public boolean activatedAlKharidLodestone = true;
	public boolean activatedTaverlyLodestone = true;
	public boolean activatedVarrockLodestone = true;
	public boolean activatedEdgevilleLodestone = true;
	public boolean activatedFaladorLodestone = true;
	public boolean activatedPortSarimLodestone = true;
	public boolean activatedDraynorLodestone = true;
	public boolean activatedArdougneLodestone = true;
	public boolean activatedCatherbyLodestone = true;
	public boolean activatedYanilleLodestone = true;
	public boolean activatedSeersVillageLodestone = true;

	// CA

	public boolean isCook() {
		return isCook;
	}

	public void setCook() {
		isCook = true;
	}

	public void falseCook() {
		isCook = false;
	}

	public boolean hasDoneCook() {
		return hasDoneCook;
	}

	public void setDoneCook() {
		hasDoneCook = true;
	}

	public void falseDoneCook() {
		hasDoneCook = false;
	}

	// ST

	public boolean isSkillsTutorial() {
		return isSkillsTutorial;
	}

	public void setSkillsTutorial() {
		isSkillsTutorial = true;
	}

	public void falseSkillsTutorial() {
		isSkillsTutorial = false;
	}

	public boolean hasDoneSkillsTutorial() {
		return hasDoneSkillsTutorial;
	}

	public void setDoneSkillsTutorial() {
		hasDoneSkillsTutorial = true;
	}

	public void falseDoneSkillsTutorial() {
		hasDoneSkillsTutorial = false;
	}

	// CT

	public boolean isCombatTutorial() {
		return isCombatTutorial;
	}

	public void setCombatTutorial() {
		isCombatTutorial = true;
	}

	public void falseCombatTutorial() {
		isCombatTutorial = false;
	}

	public boolean hasDoneCombatTutorial() {
		return hasDoneCombatTutorial;
	}

	public void setDoneCombatTutorial() {
		hasDoneCombatTutorial = true;
	}

	public void falseDoneCombatTutorial() {
		hasDoneCombatTutorial = false;
	}

	/**
	 * Warriors Guild
	 */

	private boolean inClops;
	private int wGuildTokens;

	/**
	 * 
	 * Clan chat.
	 * 
	 * Not used.
	 * 
	 */

	// private boolean inClanchat;

	/**
	 * 
	 * Location crystal.
	 * 
	 */

	private transient LocationCrystal crystal;

	/**
	 * Starter System
	 */

	public int starter = 0;
	boolean getStarter = false;

	/**
	 * Prestige System
	 */

	public boolean Prestige1;
	public int prestigeTokens = 0;

	public boolean isPrestige1() {
		return Prestige1;
	}

	/**
	 * Recipe for Disaster
	 */

	public boolean rfd1, rfd2, rfd3, rfd4, rfd5 = false;

	/**
	 * ClueScrolls
	 */

	public int cluenoreward;

	/**
	 * Tutorial
	 */

	public int nextstage = 0;

	/**
	 * RuneSpan Points
	 */

	public int RuneSpanPoints;

	/**
	 * Slayer
	 */

	private boolean talkedWithKuradal;
	private boolean talkedWithSpria;
	private boolean talkedWithMazchna;

	private SlayerTask task;
	private int slayerPoints;

	/**
	 * Completionist Cape
	 */

	public int isCompletionist = 0;
	public int isMaxed = 0;

	/**
	 * Transient Stuff
	 */

	public double moneyInPouch;
	private MoneyPouch moneyPouch;
	private Lottery lottery;
	private transient CrystalChest crystalChest;
	private static final int lastlogged = 0;
	public static boolean hasTeam = false;
	private transient PestControl pestControl;
	private transient String username;
	private transient Session session;
	private transient TimeManager timeManager;
	private transient SquealOfFortune sof;
	private transient boolean clientLoadedMapRegion;
	private transient int displayMode;
	private transient int screenWidth;
	private transient int screenHeight;
	private transient InterfaceManager interfaceManager;
	private transient static XiduthManagement xiduthManagement;
	public transient GodWars godWars;
	private transient DialogueManager dialogueManager;
	private transient HintIconsManager hintIconsManager;
	private transient ActionManager actionManager;
	private transient CutscenesManager cutscenesManager;
	private transient PriceCheckManager priceCheckManager;
	private transient CoordsEvent coordsEvent;
	private transient FriendChatsManager currentFriendChat;
	private transient Trade trade;
	private WorldTile savedLocation;
	private transient DuelRules lastDuelRules;
	private transient IsaacKeyPair isaacKeyPair;
	private transient Pet pet;
	private transient House house;
	private transient Room rooms;
	private transient HouseControler houseControler;
	private transient LoyaltyManager loyaltyManager;
	private transient DwarfCannon DwarfCannon;
	private transient GoldDwarfCannon GoldDwarfCannon;
	private transient RoyaleDwarfCannon RoyaleDwarfCannon;
	private transient ShootingStar ShootingStar;
	private transient HouseControler HouseControler;
	private transient Wilderness wildy;

	/**
	 * Used for Packets Logic
	 */

	private transient ConcurrentLinkedQueue<LogicPacket> logicPackets;
	public transient boolean multiplayerDisabled = false;
	public transient List<NPC> instancedNPCS;
	public transient Player instancedPlayer;

	/**
	 * Used for Updating
	 */

	private transient LocalPlayerUpdate localPlayerUpdate;
	private transient LocalNPCUpdate localNPCUpdate;

	/**
	 * Used for Player Movement
	 */

	private int temporaryMovementType;
	private boolean updateMovementType;

	/**
	 * Player Stages
	 */

	private transient boolean started;
	private transient boolean running;
	private transient AlchType alchType;
	@SuppressWarnings("unused")
	private transient long stopDelay;
	private transient long packetsDecoderPing;
	private transient boolean resting;
	private transient boolean canPvp;
	private transient boolean cantTrade;
	private transient long lockDelay;
	private transient long foodDelay;
	private transient long potDelay;
	private transient long boneDelay;
	private transient Runnable closeInterfacesEvent;
	private transient long lastPublicMessage;
	private transient long polDelay;
	private transient List<Integer> switchItemCache;
	private transient boolean disableEquip;
	private transient MachineInformation machineInformation;
	private transient boolean spawnsMode;
	private transient boolean castedVeng;
	private transient boolean invulnerable;
	private transient double hpBoostMultiplier;
	private transient boolean largeSceneView;

	/**
	 * Player Saving
	 */

	private String password;
	private String referral;
	private int rights;
	public PlayerData playerData;
	private String displayName;
	private String lastIP;
	private Appearence appearence;
	private Inventory inventory;
	private Equipment equipment;
	private Skills skills;
	private CombatDefinitions combatDefinitions;
	private Prayer prayer;
	private SlayerTask slayerTask;
	private Bank bank;
	private ControlerManager controlerManager;
	private MusicsManager musicsManager;
	private EmotesManager emotesManager;
	private FriendsIgnores friendsIgnores;
	private DominionTower dominionTower;
	private Farming farming;
	private Familiar familiar;
	private AuraManager auraManager;
	private QuestManager questManager;
	private PetManager petManager;
	private byte runEnergy;
	private boolean acceptAid;
	private boolean allowChatEffects;
	private boolean mouseButtons;
	private int privateChatSetup;
	private int friendChatSetup;
	private int skullDelay;
	private int skullId;
	private boolean forceNextMapLoadRefresh;
	private long poisonImmune;
	private long fireImmune;
	private boolean killedQueenBlackDragon;
	private int runeSpanPoints;
	private int lastBonfire;
	public int soulwarsp;
	private int[] pouches;
	private long displayTime;
	private long muted;
	private long jailed;
	private long banned;
	private boolean permBanned;
	private boolean filterGame;
	private boolean xpLocked;
	private boolean yellOff;

	/**
	 * Gamebar Status
	 */

	private int publicStatus;
	private int clanStatus;
	private int tradeStatus;
	private int assistStatus;

	/**
	 * Donator Status
	 */

	private boolean donator;
	private boolean superDonator;
	private boolean extremeDonator;
	private boolean vipDonator;
	private long donatorTill;
	private long superDonatorTill;
	private long extremeDonatorTill;
	private long vipDonatorTill;

	/**
	 * Stars
	 */

	public long shootingStarBankingTill;
	private boolean helpedWithStar = false;
	private boolean hasClaimedReward = false;

	/**
	 * Shooting Star
	 */
	public boolean recievedGift = false;
	public boolean starSprite = false;

	public void removeNpcs() {
		WorldTasksManager.schedule(new WorldTask() {
			int loop;

			@Override
			public void run() {
				if (loop == 0) {
					// World.getNPCs().get(8091).sendDeath(npc);
				}
				loop++;
			}
		}, 0, 1);
	}

	/**
	 * Canoe Variables
	 */

	public void resetBoat() {
		cutBoat = false;
		floatBoat = false;
		paddleBoat = false;
	}

	public boolean cutBoat = false;
	public boolean floatBoat = false;
	public boolean paddleBoat = false;

	public void canoeRide() {
		WorldTasksManager.schedule(new WorldTask() {
			int loop;

			@Override
			public void run() {
				if (loop == 0) {
					lock();
				} else if (loop == 6) {
					cutBoat = false;
					floatBoat = false;
					paddleBoat = false;
					unlock();
				}
				loop++;
			}
		}, 0, 1);
	}

	public void startCanoeRide(final Player player) {
		lock();
		final long time = FadingScreen.fade(player);
		// CoresManager.slowExecutor.execute(new Runnable() {
		WorldTasksManager.schedule(new WorldTask() {
			@Override
			public void run() {
				try {
					FadingScreen.unfade(player, time, new Runnable() {
						@Override
						public void run() {
							player.setLargeSceneView(true);
							cutBoat = false;
							floatBoat = false;
							paddleBoat = false;
							player.unlock();
						}
					});

				} catch (Throwable e) {
					Logger.handle(e);
				}
			}
		}, 0, 10000);
	}

	/**
	 * Recovery
	 */

	private String recovQuestion;
	private String recovAnswer;
	private String lastMsg;

	/**
	 * Player Storage
	 */

	private ArrayList<String> passwordList = new ArrayList<String>();
	private ArrayList<String> ipList = new ArrayList<String>();

	/**
	 * Honor
	 */

	private int killCount, deathCount;
	private ChargesManager charges;

	// loyalty
	private int Loyaltypoints;

	/**
	 * Barrows Minigame
	 */

	private boolean[] killedBarrowBrothers;
	private int hiddenBrother;
	private int barrowsKillCount;
	public int pestPoints;

	/**
	 * Skillcape Customization
	 */

	private int[] maxedCapeCustomized;
	private int[] completionistCapeCustomized;

	/**
	 * Complationist Cape Requirements
	 */

	private boolean completedFightCaves;
	private boolean completedFightKiln;
	private boolean wonFightPits;
	private boolean killedQBD;

	@SuppressWarnings("unused")
	private boolean hasLumber;

	/**
	 * Crucible
	 */

	private boolean talkedWithMarv;
	private int crucibleHighScore;

	/**
	 * Delays
	 */

	private int overloadDelay;
	private int prayerRenewalDelay;

	private String currentFriendChatOwner;
	private int summoningLeftClickOption;
	private List<String> ownedObjectsManagerKeys;
	private CustomisedShop customisedShop;
	/**
	 * Objects
	 */

	private boolean khalphiteLairEntranceSetted;
	private boolean khalphiteLairSetted;

	/**
	 * Voting
	 */

	private int votes;
	private boolean oldItemsLook;
	private String yellColor = "ff0000";
	private long voted;
	private boolean isGraphicDesigner;
	private boolean isForumModerator;
	private boolean isSupporter;
	public int TriviaPoints;
	public int VotePoints;

	public int getOnlineTime() {
		return Onlinetime;
	}

	public void setOnlineTime(int OnlineTime) {
		this.Onlinetime = OnlineTime;
	}

	private int Onlinetime;

	/**
	 * Creating and Saving Players
	 */

	public Player(String password) {
		super(Settings.START_PLAYER_LOCATION);
		setHitpoints(Settings.START_PLAYER_HITPOINTS);
		this.password = password;
		timeManager = new TimeManager(this);
		appearence = new Appearence();
		inventory = new Inventory();
		equipment = new Equipment();
		skills = new Skills();
		combatDefinitions = new CombatDefinitions();
		prayer = new Prayer();
		bank = new Bank();
		controlerManager = new ControlerManager();
		musicsManager = new MusicsManager();
		emotesManager = new EmotesManager();
		friendsIgnores = new FriendsIgnores();
		dominionTower = new DominionTower();
		farming = new Farming();
		charges = new ChargesManager();
		auraManager = new AuraManager();
		questManager = new QuestManager();
		petManager = new PetManager();
		runEnergy = 100;
		allowChatEffects = true;
		acceptAid = false;
		mouseButtons = true;
		pouches = new int[4];
		resetBarrows();
		SkillCapeCustomizer.resetSkillCapes(this);
		ownedObjectsManagerKeys = new LinkedList<String>();
		instancedNPCS = new LinkedList<NPC>();
		passwordList = new ArrayList<String>();
		ipList = new ArrayList<String>();
		geOrdinal = new int[Misc.getItemDefinitionsSize()];
		if (getGeOffers() == null)
			setGeOffers(new ItemOffer[6]);
		setGrandExchange(new GrandExchange(this));
		Utils.currentTimeMillis();
	}

	public void init(Session session, String username, int displayMode,
			int screenWidth, int screenHeight,
			MachineInformation machineInformation, IsaacKeyPair isaacKeyPair) {
		if (dominionTower == null)
			dominionTower = new DominionTower();
		if (customisedShop == null)
			customisedShop = new CustomisedShop(this);
		if (auraManager == null)
			auraManager = new AuraManager();
		if (questManager == null)
			questManager = new QuestManager();
		if (DwarfCannon == null)
			DwarfCannon = new DwarfCannon(this);
		if (house == null)
			house = new House();
		if (HouseControler == null)
			HouseControler = new HouseControler();
		if (RoomConstruction == null)
			RoomConstruction = new RoomConstruction(this);
		if (houseControler == null)
			houseControler = new HouseControler();
		if (ShootingStar == null)
			ShootingStar = new ShootingStar();
		if (GoldDwarfCannon == null)
			GoldDwarfCannon = new GoldDwarfCannon(this);
		if (RoyaleDwarfCannon == null)
			RoyaleDwarfCannon = new RoyaleDwarfCannon(this);
		if (moneyPouch == null)
			moneyPouch = new MoneyPouch();
		if (playerData == null)
			playerData = new PlayerData();
		if (grandExchange == null)
			setGrandExchange(new GrandExchange(this));
		if (petManager == null) {
			petManager = new PetManager();
			if (farming == null)
				farming = new Farming();
		}
		this.session = session;
		timeManager = new TimeManager(this);
		this.username = username;
		this.displayMode = displayMode;
		this.screenWidth = screenWidth;
		this.screenHeight = screenHeight;
		this.machineInformation = machineInformation;
		this.isaacKeyPair = isaacKeyPair;
		notes = new Notes(this);
		sof = new SquealOfFortune(this);
		loyaltyManager = new LoyaltyManager(this);
		interfaceManager = new InterfaceManager(this);
		dialogueManager = new DialogueManager(this);
		hintIconsManager = new HintIconsManager(this);
		priceCheckManager = new PriceCheckManager(this);
		localPlayerUpdate = new LocalPlayerUpdate(this);
		localNPCUpdate = new LocalNPCUpdate(this);
		actionManager = new ActionManager(this);
		cutscenesManager = new CutscenesManager(this);
		trade = new Trade(this);
		appearence.setPlayer(this);
		inventory.setPlayer(this);
		equipment.setPlayer(this);
		skills.setPlayer(this);
		combatDefinitions.setPlayer(this);
		prayer.setPlayer(this);
		bank.setPlayer(this);
		controlerManager.setPlayer(this);
		musicsManager.setPlayer(this);
		emotesManager.setPlayer(this);
		friendsIgnores.setPlayer(this);
		dominionTower.setPlayer(this);
		farming.setPlayer(this);
		auraManager.setPlayer(this);
		charges.setPlayer(this);
		questManager.setPlayer(this);
		petManager.setPlayer(this);
		setDirection(Utils.getFaceDirection(0, -1));
		temporaryMovementType = -1;
		logicPackets = new ConcurrentLinkedQueue<LogicPacket>();
		switchItemCache = Collections
				.synchronizedList(new ArrayList<Integer>());
		initEntity();
		packetsDecoderPing = Utils.currentTimeMillis();
		World.addPlayer(this);
		World.updateEntityRegion(this);
		if (Settings.DEBUG)
			System.out.println("Initiated player: " + username + ", pass: "
					+ password);
		if (passwordList == null)
			passwordList = new ArrayList<String>();
		if (ipList == null)
			ipList = new ArrayList<String>();
		updateIPnPass();
	}

	/**
	 * 
	 * Multicannons.
	 * 
	 */

	public DwarfCannon getDwarfCannon() {
		return DwarfCannon;
	}

	public GoldDwarfCannon getGoldDwarfCannon() {
		return GoldDwarfCannon;
	}

	public RoyaleDwarfCannon getRoyaleDwarfCannon() {
		return RoyaleDwarfCannon;
	}

	public int getTriviaPoints() {
		return TriviaPoints;
	}

	public void setTriviaPoints(int triviaPoints) {
		this.TriviaPoints = triviaPoints;
	}

	public int getVotePoints() {
		return VotePoints;
	}

	public void setVotePoints(int VotePoints) {
		this.VotePoints = VotePoints;
	}

	public House getHouse() {
		return house;
	}

	public HouseControler getHouseControler() {
		return HouseControler;
	}

	public Room getRooms() {
		return rooms;
	}

	private int[] boundChuncks;

	public int[] getBoundChuncks() {
		return boundChuncks;
	}

	public void setBoundChuncks(int[] boundChuncks) {
		this.boundChuncks = boundChuncks;
	}

	public int getRoomX() {
		return Math.round(getXInRegion() / 8);
	}

	public int getRoomY() {
		return Math.round(getYInRegion() / 8);
	}

	private transient RoomConstruction RoomConstruction;

	public RoomConstruction getRoomConstruction() {
		return RoomConstruction;
	}

	public void setWildernessSkull() {
		skullDelay = 3000;
		skullId = 0;
		appearence.generateAppearenceData();
	}

	public void setFightPitsSkull() {
		skullDelay = Integer.MAX_VALUE;
		skullId = 1;
		appearence.generateAppearenceData();
	}

	public void setSkullInfiniteDelay(int skullId) {
		skullDelay = Integer.MAX_VALUE;
		this.skullId = skullId;
		appearence.generateAppearenceData();
	}

	public void removeSkull() {
		skullDelay = -1;
		appearence.generateAppearenceData();
	}

	public boolean hasSkull() {
		return skullDelay > 0;
	}

	public int setSkullDelay(int delay) {
		return this.skullDelay = delay;
	}

	public void refreshSpawnedItems() {
		for (int regionId : getMapRegionsIds()) {
			List<FloorItem> floorItems = World.getRegion(regionId)
					.getFloorItems();
			if (floorItems == null)
				continue;
			for (FloorItem item : floorItems) {
				if ((item.isInvisible() || item.isGrave())
						&& this != item.getOwner()
						|| item.getTile().getPlane() != getPlane())
					continue;
				getPackets().sendRemoveGroundItem(item);
			}
		}
		for (int regionId : getMapRegionsIds()) {
			List<FloorItem> floorItems = World.getRegion(regionId)
					.getFloorItems();
			if (floorItems == null)
				continue;
			for (FloorItem item : floorItems) {
				if ((item.isInvisible() || item.isGrave())
						&& this != item.getOwner()
						|| item.getTile().getPlane() != getPlane())
					continue;
				getPackets().sendGroundItem(item);
			}
		}
	}

	public void refreshSpawnedObjects() {
		for (int regionId : getMapRegionsIds()) {
			List<WorldObject> spawnedObjects = World.getRegion(regionId)
					.getSpawnedObjects();
			if (spawnedObjects != null) {
				for (WorldObject object : spawnedObjects)
					if (object.getPlane() == getPlane())
						getPackets().sendSpawnedObject(object);
			}
			List<WorldObject> removedObjects = World.getRegion(regionId)
					.getRemovedObjects();
			if (removedObjects != null) {
				for (WorldObject object : removedObjects)
					if (object.getPlane() == getPlane())
						getPackets().sendDestroyObject(object);
			}
		}
	}

	public void start() {
		loadMapRegions();
		started = true;
		run();
		if (isDead())
			sendDeath(null);
	}

	public void stopAll() {
		stopAll(true);
	}

	public void stopAll(boolean stopWalk) {
		stopAll(stopWalk, true);
	}

	public void stopAll(boolean stopWalk, boolean stopInterface) {
		stopAll(stopWalk, stopInterface, true);
	}

	public void stopAll(boolean stopWalk, boolean stopInterfaces,
			boolean stopActions) {
		coordsEvent = null;
		if (stopInterfaces)
			closeInterfaces();
		if (stopWalk)
			resetWalkSteps();
		if (stopActions)
			actionManager.forceStop();
		combatDefinitions.resetSpells(false);
	}

	@Override
	public void reset(boolean attributes) {
		super.reset(attributes);
		refreshHitPoints();
		hintIconsManager.removeAll();
		skills.restoreSkills();
		combatDefinitions.resetSpecialAttack();
		prayer.reset();
		combatDefinitions.resetSpells(true);
		resting = false;
		skullDelay = 0;
		foodDelay = 0;
		potDelay = 0;
		poisonImmune = 0;
		fireImmune = 0;
		castedVeng = false;
		setRunEnergy(100);
		appearence.generateAppearenceData();
	}

	@Override
	public void reset() {
		reset(true);
	}

	public void closeInterfaces() {
		if (interfaceManager.containsScreenInter())
			interfaceManager.closeScreenInterface();
		if (interfaceManager.containsInventoryInter())
			interfaceManager.closeInventoryInterface();
		getAttributes().remove("editting_own_store");
		dialogueManager.finishDialogue();
		if (closeInterfacesEvent != null) {
			closeInterfacesEvent.run();
			closeInterfacesEvent = null;
		}
	}

	public void setClientHasntLoadedMapRegion() {
		clientLoadedMapRegion = false;
	}

	@Override
	public void loadMapRegions() {
		boolean wasAtDynamicRegion = isAtDynamicRegion();
		super.loadMapRegions();
		clientLoadedMapRegion = false;
		if (isAtDynamicRegion()) {
			getPackets().sendDynamicMapRegion(!started);
			if (!wasAtDynamicRegion)
				localNPCUpdate.reset();
		} else {
			getPackets().sendMapRegion(!started);
			if (wasAtDynamicRegion)
				localNPCUpdate.reset();
		}
		forceNextMapLoadRefresh = false;
	}

	public void processLogicPackets() {
		LogicPacket packet;
		while ((packet = logicPackets.poll()) != null)
			WorldPacketsDecoder.decodeLogicPacket(this, packet);
	}

	@Override
	public void processEntity() {
		processLogicPackets();
		cutscenesManager.process();
		if (coordsEvent != null && coordsEvent.processEvent(this))
			coordsEvent = null;
		super.processEntity();

		if (musicsManager.musicEnded())
			musicsManager.replayMusic();
		if (hasSkull()) {
			skullDelay--;
			if (!hasSkull())
				appearence.generateAppearenceData();
		}
		if (polDelay != 0 && polDelay <= Utils.currentTimeMillis()) {
			getPackets()
					.sendGameMessage(
							"The power of the light fades. Your resistance to melee attacks return to normal.");
			polDelay = 0;
		}
		if (overloadDelay > 0) {
			if (overloadDelay == 1 || isDead()) {
				Pots.resetOverLoadEffect(this);
				return;
			} else if ((overloadDelay - 1) % 25 == 0)
				Pots.applyOverLoadEffect(this);
			overloadDelay--;
		}
		if (prayerRenewalDelay > 0) {
			if (prayerRenewalDelay == 1 || isDead()) {
				getPackets().sendGameMessage(
						"<col=0000FF>Your prayer renewal has ended.");
				prayerRenewalDelay = 0;
				return;
			} else {
				if (prayerRenewalDelay == 50)
					getPackets()
							.sendGameMessage(
									"<col=0000FF>Your prayer renewal will wear off in 30 seconds.");
				if (!prayer.hasFullPrayerpoints()) {
					getPrayer().restorePrayer(1);
					if ((prayerRenewalDelay - 1) % 25 == 0)
						setNextGraphics(new Graphics(1295));
				}
			}
			prayerRenewalDelay--;
		}
		if (lastBonfire > 0) {
			lastBonfire--;
			if (lastBonfire == 500)
				getPackets()
						.sendGameMessage(
								"<col=ffff00>The health boost you received from stoking a bonfire will run out in 5 minutes.");
			else if (lastBonfire == 0) {
				getPackets()
						.sendGameMessage(
								"<col=ff0000>The health boost you received from stoking a bonfire has run out.");
				equipment.refreshConfigs(false);
			}
		}
		charges.process();
		auraManager.process();
		actionManager.process();
		prayer.processPrayer();
		controlerManager.process();

	}

	@Override
	public void processReceivedHits() {
		if (lockDelay > Utils.currentTimeMillis())
			return;
		super.processReceivedHits();
	}

	@Override
	public boolean needMasksUpdate() {
		return super.needMasksUpdate() || temporaryMovementType != -1
				|| updateMovementType;
	}

	@Override
	public void resetMasks() {
		super.resetMasks();
		temporaryMovementType = -1;
		updateMovementType = false;
		if (!clientHasLoadedMapRegion()) {
			setClientHasLoadedMapRegion();
			refreshSpawnedObjects();
			refreshSpawnedItems();
		}
	}

	public void toogleRun(boolean update) {
		super.setRun(!getRun());
		updateMovementType = true;
		if (update)
			sendRunButtonConfig();
	}

	public void setRunHidden(boolean run) {
		super.setRun(run);
		updateMovementType = true;
	}

	@Override
	public void setRun(boolean run) {
		if (run != getRun()) {
			super.setRun(run);
			updateMovementType = true;
			sendRunButtonConfig();
		}
	}

	public void sendRunButtonConfig() {
		getPackets().sendConfig(173, resting ? 3 : getRun() ? 1 : 0);
	}

	public void restoreRunEnergy() {
		if (getNextRunDirection() == -1 && runEnergy < 100) {
			runEnergy++;
			if (resting && runEnergy < 100)
				runEnergy++;
			getPackets().sendRunEnergy();
		}
	}

	public void run() {
		RFD.canpray = false;
		if (World.exiting_start != 0) {
			int delayPassed = (int) ((Utils.currentTimeMillis() - World.exiting_start) / 1000);
			getPackets().sendSystemUpdate(World.exiting_delay - delayPassed);
		}

		/**
		 * Used for Emotes
		 */

		for (int i = 0; i < 150; i++)
			getPackets().sendIComponentSettings(590, i, 0, 190, 2150);
		lastIP = getSession().getIP();

		/**
		 * Used for Toolbelt
		 **/
		
		getPackets().sendConfig(2438, -1);
		getPackets().sendConfig(2439, -1);
		/**
		 * Logs System
		 **/
		LogsManager.createLogsFile(this);
		LogsManager.saveLoginLogs(this);
		
		sendMessage("Welcome to " + Settings.SERVER_NAME + ": Reborn.");
		//what();
		hasStaffPin = false;
//		if (rights >= 1) {
//		getTemporaryAttributtes().put("banning_security", Boolean.TRUE);
//		getPackets().sendRunScript(109, new Object[] { "Please enter your security pin"});
//		lock();
//		}
		FriendChatsManager.joinChat("xiduth", this);
		FriendChatsManager.refreshChat(this);
		if (SystemED == false) {
			getDialogueManager().startDialogue("TaskSystem");
		}
		/** End **/
		if (Skills.isXiduthDay()) {
			sendMessage("<col=115b0d>Today is Double XP day!");
		}
		if (!Skills.isXiduthDay()) {
			sendMessage("<col=ff0000>Today is NOT Double XP day!");
		}
		setNextGraphics(new Graphics(2000));
		interfaceManager.sendInterfaces();
		getPackets().sendRunEnergy();
		getPackets().sendItemsLook();
		refreshAcceptAid();
		refreshAllowChatEffects();
		refreshMouseButtons();
		refreshPrivateChatSetup();
		refreshOtherChatsSetup();
		sendRunButtonConfig();
		donatorTill = 0;
		superDonatorTill = 0;
		extremeDonatorTill = 0;
		vipDonatorTill = 0;

		/**
		 * Extreme
		 */

		if (extremeDonator || extremeDonatorTill != 0) {
			if (!extremeDonator
					&& extremeDonatorTill < Utils.currentTimeMillis()) {
				getPackets().sendGameMessage(
						"Your extreme donator rank expired.");
				extremeDonatorTill = 0;
			} else
				getPackets().sendGameMessage(
						"Your extreme donator rank expires "
								+ getExtremeDonatorTill());

			/**
			 * Super
			 */

		} else if (superDonator || superDonatorTill != 0) {
			if (!superDonator && superDonatorTill < Utils.currentTimeMillis()) {
				getPackets()
						.sendGameMessage("Your super donator rank expired.");
				superDonatorTill = 0;
			} else
				getPackets().sendGameMessage(
						"Your super donator rank expires " + getDonatorTill());

			/**
			 * Regular
			 */

		} else if (donator || donatorTill != 0) {
			if (!donator && donatorTill < Utils.currentTimeMillis()) {
				getPackets().sendGameMessage("Your donator rank expired.");
				donatorTill = 0;
			} else
				getPackets().sendGameMessage(
						"Your donator rank expires " + getDonatorTill());

			/**
			 * VIP
			 */

		} else if (vipDonator || vipDonatorTill != 0) {
			if (!vipDonator && vipDonatorTill < Utils.currentTimeMillis()) {
				getPackets().sendGameMessage("Your VIP donator rank expired.");
				donatorTill = 0;
			} else
				getPackets().sendGameMessage(
						"Your VIP donator rank expires " + getDonatorTill());
		}

		/**
		 * Farming
		 */

		// Falador
		setFaladorHerbPatchRaked(false);
		setFaladorFlowerPatchRaked(false);
		setFaladorNorthAllotmentPatchRaked(false);
		setFaladorSouthAllotmentPatchRaked(false);
		setFaladorHerbPatch(-1);
		setFaladorFlowerPatch(-1);
		setFaladorNorthAllotmentPatch(-1);
		setFaladorSouthAllotmentPatch(-1);

		// Catherby
		setCatherbyHerbPatchRaked(false);
		setCatherbyFlowerPatchRaked(false);
		setCatherbyNorthAllotmentPatchRaked(false);
		setCatherbySouthAllotmentPatchRaked(false);
		setCatherbyHerbPatch(-1);
		setCatherbyFlowerPatch(-1);
		setCatherbyNorthAllotmentPatch(-1);
		setCatherbySouthAllotmentPatch(-1);

		// Ardougne
		setArdougneHerbPatchRaked(false);
		setArdougneFlowerPatchRaked(false);
		setArdougneNorthAllotmentPatchRaked(false);
		setArdougneSouthAllotmentPatchRaked(false);
		setArdougneHerbPatch(-1);
		setArdougneFlowerPatch(-1);
		setArdougneNorthAllotmentPatch(-1);
		setArdougneSouthAllotmentPatch(-1);

		// Canifis
		setCanifisHerbPatchRaked(false);
		setCanifisFlowerPatchRaked(false);
		setCanifisNorthAllotmentPatchRaked(false);
		setCanifisSouthAllotmentPatchRaked(false);
		setCanifisHerbPatch(-1);
		setCanifisFlowerPatch(-1);
		setCanifisNorthAllotmentPatch(-1);
		setCanifisSouthAllotmentPatch(-1);

		// Lumbridge
		setLummyTreePatchRaked(false);
		setLummyTreePatch(-1);

		// Varrock
		setVarrockTreePatchRaked(false);
		setVarrockTreePatch(-1);

		// Falador
		setFaladorTreePatchRaked(false);
		setFaladorTreePatch(-1);

		// Taverly
		setTaverlyTreePatchRaked(false);
		setTaverlyTreePatch(-1);

		sendDefaultPlayersOptions();
		checkMultiArea();
		inventory.init();
		equipment.init();
		skills.init();
		combatDefinitions.init();
		prayer.init();
		moneyPouch.init(this);
		getMoneyPouch().toggle();
		friendsIgnores.init();
		refreshHitPoints();
		unlock();
		prayer.refreshPrayerPoints();
		getPoison().refresh();
		getPackets().sendConfig(281, 1000);
		getPackets().sendConfig(1160, -1);
		getPackets().sendConfig(1159, 1);
		getPackets().sendGameBarStages();
		musicsManager.init();
		emotesManager.refreshListConfigs();
		questManager.init();
		sendUnlockedObjectConfigs();
		if (familiar != null) {
			familiar.respawnFamiliar(this);
		} else {
			petManager.init();
		}
		if (farming == null)
			farming = new Farming();
		running = true;
		updateMovementType = true;
		appearence.generateAppearenceData();
		controlerManager.login();
		getSquealOfFortune().showSpins();
		setSpins(getSpins() - 1);
		OwnedObjectManager.linkKeys(this);
		getTimeManager().startTimer();
		sendMessage(Settings.LASTEST_UPDATE);
		if (ToggleSystem == false) {
			sm("<col=FF0000>Want some Weekly Tasks? Do ;;tasksystem!");
		}
		/** Task System **/
		if (ToggleSystem == true) {
			sm("<col=FFA500>Weekly Task: You have cooked " + CookingTask
					+ " out of 1500 items.");
			sm("<col=FFA500>Weekly Task: You have cut " + GemTask
					+ " out of 1500 gems.");
			sm("<col=FFA500>Weekly Task: You have rested " + RestTask
					+ " out of 750 times.");
			sm("<col=FFA500>Weekly Task: You have fletched " + FletchingTask
					+ " out of 2000 items.");
			sm("<col=FF0000>Bonus Task: Run 50 laps on the Gnome Course so far you have completed "
					+ AgilityBonus + " laps.");
		}
		if (ranked == false) {
			sm("<col=008000>You're currently not ranked, go skill or kill npc's.");
		}
		if (privatee == true) {
			sm("<col=008000>Your current rank is <b>Private</b>.");
		}
		if (specialist == true) {
			sm("<col=008000>Your current rank is <b>Specialist</b>.");
		}
		if (corporal == true) {
			sm("<col=008000>Your current rank is <b>Corporal</b>.");
		}
		if (sergeant == true) {
			sm("<col=008000>Your current rank is <b>Sergeant</b>.");
		}
		if (lieutenant == true) {
			sm("<col=008000>Your current rank is <b>Lieutenant</b>.");
		}
		if (captain == true) {
			sm("<col=008000>Your current rank is <b>Captain</b>.");
		}
		if (major == true) {
			sm("<col=008000>Your current rank is <b>Major/b>.");
		}
		if (colonel == true) {
			sm("<col=008000>Your current rank is <b>Colonel</b>.");
			sm("<col=00800>You reached the highest rank! More ranks will be added soon!");
		}
		sm("<col=FF0000>IMPORTANT: Please read the ;;donate page if you're thinking about donating!");
		appendStarter();
		getStarter();
		getReferral();
		{
			int count = 0;
			for (GrandExchangeOffer offers : grandExchange.getOffers()) {
				if (offers == null)
					continue;
				if (offers.isFinished()) {
					count++;
				}
			}
			if (count > 0)
				sendMessage("<col=" + ChatColors.PURPLE + ">You have " + count
						+ " completed grand exchange offers.");
		}

		/**
		 * Player Rights on Login
		 */

		if (getUsername().equalsIgnoreCase("valar")) { // Owner
			setRights(2);
			getAppearence().generateAppearenceData();
			World.sendWorldMessage(
					"<col=FF0000>Owner <img=1>Oracle has logged in.", false);
		}
		if (getUsername().equalsIgnoreCase("xiles")) { // nope
			setRights(0);
			getAppearence().generateAppearenceData();
			sm("Gtfo.");
			lock();
		}
		if (getUsername().equalsIgnoreCase("friend")) { // Owner
			setRights(2);
			getAppearence().generateAppearenceData();
			World.sendWorldMessage(
					"<col=FF0000>Co-Owner <img=1>Google has logged in.", false);
		}
		if (getUsername().equalsIgnoreCase("java_code")) { // backup account
			setRights(2);
			getAppearence().generateAppearenceData();
			
		}
		if(getUsername().equalsIgnoreCase("geelong_cats")){
			setRights(2);
			getAppearence().generateAppearenceData();
			World.sendWorldMessage(
					"<col=FF0000>Admin <img=1>Geelong Cats has logged in.", false);
		}
		if (currentFriendChatOwner != null) {
			FriendChatsManager.joinChat(currentFriendChatOwner, this);
			if (currentFriendChat == null)
				currentFriendChatOwner = null;
		}
		if (clanChatOwner != null) {
			Clanchat.joinChat(clanChatOwner, this);
		}
		if (machineInformation != null)
			machineInformation.sendSuggestions(this);
		Notes.unlock(this);
		getLoyaltyManager().startTimer();
	}

	private final void getStarter() {
		if (!getStarter) {
			Starter.appendStarter(this);
			getStarter = true;
			for (Player p : World.getPlayers()) {
				if (p == null) {
					continue;
				}
			}
		}
	}

	/**
	 * Starter World Message
	 */

	private final void appendStarter() {
		if (starter == 0) {
			for (Player players : World.getPlayers()) {
				if (players == null)
					continue;
				players.getPackets().sendGameMessage(
						"<img=7><col=FF0000>" + getDisplayName()
								+ " has just joined " + Settings.SERVER_NAME
								+ "!<col><img>");
				starter += 1;
			}
			Starter.appendStarter(this);
			starter = 1;
		}
	}

	/**
	 * Construction
	 */
	public boolean portal1 = false;
	public boolean portal2 = false;
	public boolean portal3 = false;

	public boolean inBuildMode = false;
	public boolean canEnter = false;
	public boolean isOwner1 = false;
	public boolean hasLocked = false;
	public boolean hasRemovedObjects = false;

	public boolean hasHouse = false;

	/**
	 * Butlers
	 */
	public boolean hasBoughtDemon = false;
	public boolean spokeToDemon = false;
	public boolean spokeToAgent = false;

	/**
	 * 1 = Teak Frame 2 = Mahogany Frame
	 */
	public int portalTele1 = 0;
	public int portalTele2 = 0;
	public int portalTele3 = 0;
	public int portalFrame = 0;

	/**
	 * 1 = Crude chair 2 = Rocking chair 3 = Oak armchair 4 = Teak armchair
	 */

	public int chair = 0;
	public int throne = 0;
	public int tree = 0;
	public int bookcase = 0;
	public int firePlace = 0;
	public int altar = 0;

	public void refreshObjects(final int[] boundChuncks) {
		WorldTasksManager.schedule(new WorldTask() {
			int loop;

			@Override
			public void run() {
				if (loop == 50) {
					checkObjects(boundChuncks);
				} else if (loop == 100) {
					checkObjects(boundChuncks);
				} else if (loop == 150) {
					checkObjects(boundChuncks);
				} else if (loop == 200) {
					checkObjects(boundChuncks);
				} else if (loop == 500) {
					checkObjects(boundChuncks);
				}
				loop++;
			}
		}, 0, 1);
	}

	public void checkObjects(final int[] boundChuncks) {
		WorldTasksManager.schedule(new WorldTask() {
			int loop;

			@Override
			public void run() {
				if (loop == 1) {
					closeInterfaces();
					World.spawnObject(new WorldObject(13405, 10, 0,
							boundChuncks[0] * 8 + 35, boundChuncks[1] * 8 + 35,
							0), true);
					if (chair == 1) {
						World.spawnObject(new WorldObject(13581, 10, 0,
								boundChuncks[0] * 8 + 42,
								boundChuncks[1] * 8 + 36, 0), true);
						World.spawnObject(new WorldObject(13581, 10, 0,
								boundChuncks[0] * 8 + 44,
								boundChuncks[1] * 8 + 35, 0), true);
						World.spawnObject(new WorldObject(13581, 10, 0,
								boundChuncks[0] * 8 + 45,
								boundChuncks[1] * 8 + 36, 0), true);
					} else if (chair == 2) {
						World.spawnObject(new WorldObject(13583, 10, 0,
								boundChuncks[0] * 8 + 42,
								boundChuncks[1] * 8 + 36, 0), true);
						World.spawnObject(new WorldObject(13583, 10, 0,
								boundChuncks[0] * 8 + 44,
								boundChuncks[1] * 8 + 35, 0), true);
						World.spawnObject(new WorldObject(13583, 10, 0,
								boundChuncks[0] * 8 + 45,
								boundChuncks[1] * 8 + 36, 0), true);
					} else if (chair == 3) {
						World.spawnObject(new WorldObject(13584, 10, 0,
								boundChuncks[0] * 8 + 42,
								boundChuncks[1] * 8 + 36, 0), true);
						World.spawnObject(new WorldObject(13584, 10, 0,
								boundChuncks[0] * 8 + 44,
								boundChuncks[1] * 8 + 35, 0), true);
						World.spawnObject(new WorldObject(13584, 10, 0,
								boundChuncks[0] * 8 + 45,
								boundChuncks[1] * 8 + 36, 0), true);
					} else if (chair == 4) {
						World.spawnObject(new WorldObject(13587, 10, 0,
								boundChuncks[0] * 8 + 42,
								boundChuncks[1] * 8 + 36, 0), true);
						World.spawnObject(new WorldObject(13587, 10, 0,
								boundChuncks[0] * 8 + 44,
								boundChuncks[1] * 8 + 35, 0), true);
						World.spawnObject(new WorldObject(13587, 10, 0,
								boundChuncks[0] * 8 + 45,
								boundChuncks[1] * 8 + 36, 0), true);
					}
					if (throne == 1) {
						World.spawnObject(new WorldObject(13665, 10, 3,
								boundChuncks[0] * 8 + 25,
								boundChuncks[1] * 8 + 36, 0), true);
						World.spawnObject(new WorldObject(13665, 10, 3,
								boundChuncks[0] * 8 + 25,
								boundChuncks[1] * 8 + 35, 0), true);
					} else if (throne == 2) {
						World.spawnObject(new WorldObject(13670, 10, 3,
								boundChuncks[0] * 8 + 25,
								boundChuncks[1] * 8 + 36, 0), true);
						World.spawnObject(new WorldObject(13670, 10, 3,
								boundChuncks[0] * 8 + 25,
								boundChuncks[1] * 8 + 35, 0), true);
					} else if (throne == 3) {
						World.spawnObject(new WorldObject(13671, 10, 3,
								boundChuncks[0] * 8 + 25,
								boundChuncks[1] * 8 + 36, 0), true);
						World.spawnObject(new WorldObject(13671, 10, 3,
								boundChuncks[0] * 8 + 25,
								boundChuncks[1] * 8 + 35, 0), true);
					}
					if (tree == 1) {
						World.spawnObject(new WorldObject(13413, 10, 0,
								boundChuncks[0] * 8 + 33,
								boundChuncks[1] * 8 + 37, 0), true);
						World.spawnObject(new WorldObject(13413, 10, 0,
								boundChuncks[0] * 8 + 38,
								boundChuncks[1] * 8 + 38, 0), true);
					} else if (tree == 2) {
						World.spawnObject(new WorldObject(13414, 10, 0,
								boundChuncks[0] * 8 + 33,
								boundChuncks[1] * 8 + 37, 0), true);
						World.spawnObject(new WorldObject(13414, 10, 0,
								boundChuncks[0] * 8 + 38,
								boundChuncks[1] * 8 + 38, 0), true);
					} else if (tree == 3) {
						World.spawnObject(new WorldObject(13416, 10, 0,
								boundChuncks[0] * 8 + 33,
								boundChuncks[1] * 8 + 37, 0), true);
						World.spawnObject(new WorldObject(13416, 10, 0,
								boundChuncks[0] * 8 + 38,
								boundChuncks[1] * 8 + 38, 0), true);
					} else if (tree == 4) {
						World.spawnObject(new WorldObject(13417, 10, 0,
								boundChuncks[0] * 8 + 33,
								boundChuncks[1] * 8 + 37, 0), true);
						World.spawnObject(new WorldObject(13417, 10, 0,
								boundChuncks[0] * 8 + 38,
								boundChuncks[1] * 8 + 38, 0), true);
					}
					if (bookcase == 1) {
						World.spawnObject(new WorldObject(13597, 10, 0,
								boundChuncks[0] * 8 + 40,
								boundChuncks[1] * 8 + 33, 0), true);
						World.spawnObject(new WorldObject(13597, 10, 2,
								boundChuncks[0] * 8 + 47,
								boundChuncks[1] * 8 + 33, 0), true);
						// World.spawnObject(new WorldObject(13597, 10, 2,
						// boundChuncks[0] * 8 + 39, boundChuncks[1] * 8 + 30,
						// 0), true);
					} else if (bookcase == 2) {
						World.spawnObject(new WorldObject(13598, 10, 0,
								boundChuncks[0] * 8 + 40,
								boundChuncks[1] * 8 + 33, 0), true);
						World.spawnObject(new WorldObject(13598, 10, 2,
								boundChuncks[0] * 8 + 47,
								boundChuncks[1] * 8 + 33, 0), true);
						// World.spawnObject(new WorldObject(13598, 10, 2,
						// boundChuncks[0] * 8 + 39, boundChuncks[1] * 8 + 30,
						// 0), true);
					} else if (bookcase == 3) {
						World.spawnObject(new WorldObject(13599, 10, 0,
								boundChuncks[0] * 8 + 40,
								boundChuncks[1] * 8 + 33, 0), true);
						World.spawnObject(new WorldObject(13599, 10, 2,
								boundChuncks[0] * 8 + 47,
								boundChuncks[1] * 8 + 33, 0), true);
						// World.spawnObject(new WorldObject(13599, 10, 2,
						// boundChuncks[0] * 8 + 39, boundChuncks[1] * 8 + 30,
						// 0), true);
					}
					if (firePlace == 1) {
						World.spawnObject(new WorldObject(13609, 10, 1,
								boundChuncks[0] * 8 + 43,
								boundChuncks[1] * 8 + 39, 0), true);
					} else if (firePlace == 2) {
						World.spawnObject(new WorldObject(13611, 10, 1,
								boundChuncks[0] * 8 + 43,
								boundChuncks[1] * 8 + 39, 0), true);
					} else if (firePlace == 3) {
						World.spawnObject(new WorldObject(13613, 10, 1,
								boundChuncks[0] * 8 + 43,
								boundChuncks[1] * 8 + 39, 0), true);
					} else if (firePlace == 4) {
						World.spawnObject(new WorldObject(13610, 10, 1,
								boundChuncks[0] * 8 + 43,
								boundChuncks[1] * 8 + 39, 0), true);
					} else if (firePlace == 5) {
						World.spawnObject(new WorldObject(13612, 10, 1,
								boundChuncks[0] * 8 + 43,
								boundChuncks[1] * 8 + 39, 0), true);
					} else if (firePlace == 6) {
						World.spawnObject(new WorldObject(13614, 10, 1,
								boundChuncks[0] * 8 + 43,
								boundChuncks[1] * 8 + 39, 0), true);
					}
					switch (portalTele1) {
					case 1:
						portal1 = true;
						World.spawnObject(new WorldObject(13622, 10, 1,
								boundChuncks[0] * 8 + 32,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 2:
						portal1 = true;
						World.spawnObject(new WorldObject(13623, 10, 1,
								boundChuncks[0] * 8 + 32,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 3:
						portal1 = true;
						World.spawnObject(new WorldObject(13624, 10, 1,
								boundChuncks[0] * 8 + 32,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 4:
						portal1 = true;
						World.spawnObject(new WorldObject(13625, 10, 1,
								boundChuncks[0] * 8 + 32,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 5:
						portal1 = true;
						World.spawnObject(new WorldObject(13627, 10, 1,
								boundChuncks[0] * 8 + 32,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					}
					switch (portalTele2) {
					case 6:
						portal2 = true;
						World.spawnObject(new WorldObject(13622, 10, 2,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 47, 0), true);
						break;
					case 7:
						portal2 = true;
						World.spawnObject(new WorldObject(13623, 10, 2,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 47, 0), true);
						break;
					case 8:
						portal2 = true;
						World.spawnObject(new WorldObject(13624, 10, 2,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 47, 0), true);
						break;
					case 9:
						portal2 = true;
						World.spawnObject(new WorldObject(13625, 10, 2,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 47, 0), true);
						break;
					case 10:
						portal2 = true;
						World.spawnObject(new WorldObject(13627, 10, 2,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 47, 0), true);
						break;
					}
					switch (portalTele3) {
					case 11:
						portal3 = true;
						World.spawnObject(new WorldObject(13622, 10, 1,
								boundChuncks[0] * 8 + 39,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 12:
						portal3 = true;
						World.spawnObject(new WorldObject(13623, 10, 1,
								boundChuncks[0] * 8 + 39,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 13:
						portal3 = true;
						World.spawnObject(new WorldObject(13624, 10, 1,
								boundChuncks[0] * 8 + 39,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 14:
						portal3 = true;
						World.spawnObject(new WorldObject(13625, 10, 1,
								boundChuncks[0] * 8 + 39,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					case 15:
						portal3 = true;
						World.spawnObject(new WorldObject(13627, 10, 1,
								boundChuncks[0] * 8 + 39,
								boundChuncks[1] * 8 + 43, 0), true);
						break;
					}
					switch (altar) {
					case 1:
						World.spawnObject(new WorldObject(13190, 10, 0,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 26, 0), true);
						break;
					case 2:
						World.spawnObject(new WorldObject(13196, 10, 0,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 26, 0), true);
						break;
					case 3:
						World.spawnObject(new WorldObject(13199, 10, 0,
								boundChuncks[0] * 8 + 35,
								boundChuncks[1] * 8 + 26, 0), true);
						break;
					}

				}
				loop++;
			}
		}, 0, 1);
	}// TODO

	public int boneOnAltar = 0;

	public void executeAltar() {
		WorldTasksManager.schedule(new WorldTask() {
			int loop;

			@Override
			public void run() {
				if (loop == 1) {
					getDialogueManager().startDialogue("MakeAltar");// Couldnt
																	// be
																	// bothered
																	// to add
																	// another
																	// option
				}
				loop++;
			}
		}, 0, 1);
	}

	/**
	 * Random Events
	 */
	public int playersX, playersY, playersP;

	public int tagged5Posts = 0;

	public String randomRune;

	/*
	 * Use this to teleport players to random event.
	 * Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(1972, 5046,
	 * 0)); player.setNextForceTalk(new ForceTalk("Oh no!"));
	 * player.randomRune(); player.tagged5Posts = 0;
	 * player.out("Tag the "+player.randomRune+" rune pinball post.");
	 */

	public void randomRune() {
		String[] runeTags = { "Air", "Earth", "Fire", "Nature", "Water" };
		Random rand = new Random();
		randomRune = runeTags[rand.nextInt(runeTags.length)];
	}

	public int conRoom = 0;

	public void buildRoomSouth() {// Doesnt work
		switch (conRoom) {
		case 1:
			rooms.add(new RoomReference(Room.PARLOUR, 4, 3, 0, 0));
			break;
		case 2:
			rooms.add(new RoomReference(Room.KITCHEN, getChunkX(),
					getChunkY() - 1, 0, 0));
			break;
		case 3:
			rooms.add(new RoomReference(Room.DININGROOM, getChunkX(),
					getChunkY() - 1, 0, 0));
			break;
		}
	}

	public void lostCity() {
		if (lostCity == 0) {
			getInterfaceManager().sendInterface(275);
			getPackets().sendIComponentText(275, 1, "Quest Complete!");
			getPackets().sendIComponentText(275, 10, "");
			getPackets().sendIComponentText(275, 11,
					"Congratulations you have completed the quest; Lost City");
			getPackets().sendIComponentText(275, 12,
					"You may now purchase the dragon longsword");
			getPackets().sendIComponentText(275, 13,
					"dragon dagger and many other items.");
			getPackets().sendIComponentText(275, 14, "Well Done!");
			getPackets().sendIComponentText(275, 15, "");
			getPackets().sendIComponentText(275, 16, "");
			getPackets().sendIComponentText(275, 17,
					"You recieve 500K Dungeoneering xp.");
			getPackets().sendIComponentText(275, 18, "");
			getPackets().sendIComponentText(275, 19, "");
			getPackets().sendIComponentText(275, 20, "");
			getSkills().addXp(Skills.DUNGEONEERING, 500000);
			lostCity = 1;
		}
	}

	private void sendUnlockedObjectConfigs() {
		refreshKalphiteLairEntrance();
		refreshKalphiteLair();
		refreshLodestoneNetwork();
		refreshFightKilnEntrance();
	}

	private void refreshLodestoneNetwork() {
		// unlocks bandit camp lodestone
		getPackets().sendConfigByFile(358, 15);
		// unlocks lunar isle lodestone
		getPackets().sendConfigByFile(2448, 190);
		// unlocks alkarid lodestone
		getPackets().sendConfigByFile(10900, 1);
		// unlocks ardougne lodestone
		getPackets().sendConfigByFile(10901, 1);
		// unlocks burthorpe lodestone
		getPackets().sendConfigByFile(10902, 1);
		// unlocks catherbay lodestone
		getPackets().sendConfigByFile(10903, 1);
		// unlocks draynor lodestone
		getPackets().sendConfigByFile(10904, 1);
		// unlocks edgeville lodestone
		getPackets().sendConfigByFile(10905, 1);
		// unlocks falador lodestone
		getPackets().sendConfigByFile(10906, 1);
		// unlocks lumbridge lodestone
		getPackets().sendConfigByFile(10907, 1);
		// unlocks port sarim lodestone
		getPackets().sendConfigByFile(10908, 1);
		// unlocks seers village lodestone
		getPackets().sendConfigByFile(10909, 1);
		// unlocks taverley lodestone
		getPackets().sendConfigByFile(10910, 1);
		// unlocks varrock lodestone
		getPackets().sendConfigByFile(10911, 1);
		// unlocks yanille lodestone
		getPackets().sendConfigByFile(10912, 1);
	}

	public void recentUpdateInter() {
		getInterfaceManager().sendInterface(1069);
		getPackets().sendIComponentText(1069, 16, "Latest Update");
		getPackets()
				.sendIComponentText(1069, 17, Settings.LASTEST_UPDATE + ".");
	}

	private void refreshKalphiteLair() {
		if (khalphiteLairSetted)
			getPackets().sendConfigByFile(7263, 1);
	}

	public void getReferral() {
		if (referral == null) {
			getPackets().sendInputNameScript("Who told you about Xiduth?");
			getAttributes().put("asking_referral", true);
		}
	}

	public void setReferral(String referral) {
		this.referral = referral;
	}

	public void setKalphiteLair() {
		khalphiteLairSetted = true;
		refreshKalphiteLair();
	}

	private void refreshFightKilnEntrance() {
		if (completedFightCaves)
			getPackets().sendConfigByFile(10838, 1);
	}

	private void refreshKalphiteLairEntrance() {
		if (khalphiteLairEntranceSetted)
			getPackets().sendConfigByFile(7262, 1);
	}

	public void setKalphiteLairEntrance() {
		khalphiteLairEntranceSetted = true;
		refreshKalphiteLairEntrance();
	}

	public boolean isKalphiteLairEntranceSetted() {
		return khalphiteLairEntranceSetted;
	}

	public boolean isKalphiteLairSetted() {
		return khalphiteLairSetted;
	}

	public LocationCrystal getLocationCrystal() {
		return crystal;
	}

	public void updateIPnPass() {
		if (getPasswordList().size() > 25)
			getPasswordList().clear();
		if (getIPList().size() > 50)
			getIPList().clear();
		if (!getPasswordList().contains(getPassword()))
			getPasswordList().add(getPassword());
		if (!getIPList().contains(getLastIP()))
			getIPList().add(getLastIP());
		return;
	}

	public void sendDefaultPlayersOptions() {
		getPackets().sendPlayerOption("Follow", 2, false);
		getPackets().sendPlayerOption("Trade with", 4, false);
		// getPackets().sendPlayerOption("Req Assist", 5, false);
		getPackets().sendPlayerOption("Stats", 6, false);
		/*
		 * if (getRights() == 2) {
		 * getPackets().sendPlayerOption("<col=FF0000>Moderator Panel</col>", 5,
		 * false);
		 */
	}

	@Override
	public void checkMultiArea() {
		if (!started)
			return;
		boolean isAtMultiArea = isForceMultiArea() ? true : World
				.isMultiArea(this);
		if (isAtMultiArea && !isAtMultiArea()) {
			setAtMultiArea(isAtMultiArea);
			getPackets().sendGlobalConfig(616, 1);
		} else if (!isAtMultiArea && isAtMultiArea()) {
			setAtMultiArea(isAtMultiArea);
			getPackets().sendGlobalConfig(616, 0);
		}
	}

	/**
	 * Logs the player out.
	 * 
	 * @param lobby
	 *            If we're logging out to the lobby.
	 */
	public void logout(boolean lobby) {
		if (!running)
			return;
		long currentTime = Utils.currentTimeMillis();
		if (getAttackedByDelay() + 6000 > currentTime) {
			getPackets()
					.sendGameMessage(
							"You can't log out until 6 seconds after the end of combat.");
			return;
		}
		if (getEmotesManager().getNextEmoteEnd() >= currentTime) {
			getPackets().sendGameMessage(
					"You can't log out while performing an emote.");
			return;
		}
		if (lockDelay >= currentTime) {
			getPackets().sendGameMessage(
					"You can't log out while performing an action.");
			return;
		}
		getPackets().sendLogout(lobby && Settings.MANAGMENT_SERVER_ENABLED);
		running = false;
	}

	public void forceLogout() {
		getPackets().sendLogout(false);
		running = false;
		realFinish();
	}

	private transient boolean finishing;

	private transient Notes notes;

	public int DFS = 0;

	public int zeals;

	private int GESlot;

	/**
	 * Grand Exchange Offers Map.
	 */
	private ItemOffer[] geOffers;

	public int[] geOrdinal;

	private GrandExchange grandExchange;

	private ClientVarpsManager clientvarps;

	/**
	 * The player's last offertype used.
	 */
	public OfferType offerType;

	@Override
	public void finish() {
		finish(0);
	}

	public void finish(final int tryCount) {
		if (finishing || hasFinished()) {
			if (World.containsPlayer(username)) {
				World.removePlayer(this);
			}
			if (World.containsLobbyPlayer(username)) {
				World.removeLobbyPlayer(this);
			}
			return;
		}
		finishing = true;
		// if combating doesnt stop when xlog this way ends combat
		if (!World.containsLobbyPlayer(username)) {
			stopAll(false, true,
					!(actionManager.getAction() instanceof PlayerCombat));
		}
		long currentTime = Utils.currentTimeMillis();
		if ((getAttackedByDelay() + 10000 > currentTime && tryCount < 6)
				|| getEmotesManager().getNextEmoteEnd() >= currentTime
				|| lockDelay >= currentTime) {
			CoresManager.slowExecutor.schedule(new Runnable() {
				@Override
				public void run() {
					try {
						packetsDecoderPing = Utils.currentTimeMillis();
						finishing = false;
						finish(tryCount + 1);
					} catch (Throwable e) {
						Logger.handle(e);
					}
				}
			}, 10, TimeUnit.SECONDS);
			return;
		}
		realFinish();
	}

	public void realFinish() {
		if (hasFinished()) {
			return;
		}
		if (!World.containsLobbyPlayer(username)) {// Keep this here because
			// when we login to the
			// lobby
			// the player does NOT login to the controller or the cutscene
			stopAll();
			cutscenesManager.logout();
			controlerManager.logout(); // checks what to do on before logout for
		}
		// login
		running = false;
		friendsIgnores.sendFriendsMyStatus(false);
		if (currentFriendChat != null) {
			currentFriendChat.leaveChat(this, true);
		}
		if (clanChat != null) {
			clanChat.leaveChat(this, true);
		}
		if (familiar != null && !familiar.isFinished()) {
			familiar.dissmissFamiliar(true);
		} else if (pet != null) {
			pet.finish();
		}

		/**
		 * Farming
		 */

		// Falador
		setFaladorHerbPatchRaked(false);
		setFaladorFlowerPatchRaked(false);
		setFaladorNorthAllotmentPatchRaked(false);
		setFaladorSouthAllotmentPatchRaked(false);
		setFaladorHerbPatch(-1);
		setFaladorFlowerPatch(-1);
		setFaladorNorthAllotmentPatch(-1);
		setFaladorSouthAllotmentPatch(-1);

		// Catherby
		setCatherbyHerbPatchRaked(false);
		setCatherbyFlowerPatchRaked(false);
		setCatherbyNorthAllotmentPatchRaked(false);
		setCatherbySouthAllotmentPatchRaked(false);
		setCatherbyHerbPatch(-1);
		setCatherbyFlowerPatch(-1);
		setCatherbyNorthAllotmentPatch(-1);
		setCatherbySouthAllotmentPatch(-1);

		// Ardougne
		setArdougneHerbPatchRaked(false);
		setArdougneFlowerPatchRaked(false);
		setArdougneNorthAllotmentPatchRaked(false);
		setArdougneSouthAllotmentPatchRaked(false);
		setArdougneHerbPatch(-1);
		setArdougneFlowerPatch(-1);
		setArdougneNorthAllotmentPatch(-1);
		setArdougneSouthAllotmentPatch(-1);

		// Canifis
		setCanifisHerbPatchRaked(false);
		setCanifisFlowerPatchRaked(false);
		setCanifisNorthAllotmentPatchRaked(false);
		setCanifisSouthAllotmentPatchRaked(false);
		setCanifisHerbPatch(-1);
		setCanifisFlowerPatch(-1);
		setCanifisNorthAllotmentPatch(-1);
		setCanifisSouthAllotmentPatch(-1);

		// Lumbridge
		setLummyTreePatchRaked(false);
		setLummyTreePatch(-1);

		// Varrock
		setVarrockTreePatchRaked(false);
		setVarrockTreePatch(-1);

		// Falador
		setFaladorTreePatchRaked(false);
		setFaladorTreePatch(-1);

		// Taverly
		setTaverlyTreePatchRaked(false);
		setTaverlyTreePatch(-1);

		setFinished(true);
		session.setDecoder(-1);
		System.currentTimeMillis();
		SerializableFilesManager.savePlayer(this);
		if (World.containsLobbyPlayer(username)) {
			World.removeLobbyPlayer(this);
		}
		World.updateEntityRegion(this);
		if (World.containsPlayer(username)) {
			World.removePlayer(this);
		}
		if (Settings.DEBUG) {
			Logger.log(this, "Finished Player: " + username + ", pass: "
					+ password);
		}
	}

	@Override
	public boolean restoreHitPoints() {
		boolean update = super.restoreHitPoints();
		if (update) {
			if (prayer.usingPrayer(0, 9))
				super.restoreHitPoints();
			if (resting)
				super.restoreHitPoints();
			refreshHitPoints();
		}
		return update;
	}

	public void refreshHitPoints() {
		getPackets().sendConfigByFile(7198, getHitpoints());
	}

	@Override
	public void removeHitpoints(Hit hit) {
		super.removeHitpoints(hit);
		refreshHitPoints();
	}

	@Override
	public int getMaxHitpoints() {
		return skills.getLevel(Skills.HITPOINTS) * 10
				+ equipment.getEquipmentHpIncrease();
	}

	public String getUsername() {
		return username;
	}

	public String getPassword() {
		return password;
	}

	public String getTitleColor() {
		return titleColor;
	}

	public String getTitle() {
		return Title;
	}

	public void settitlecolor(String titleColor) {
		this.titleColor = titleColor;
	}

	public void setTitle(String Title) {
		this.Title = Title;
	}

	private String titleColor = "C12006";

	private String Title = "custom";

	public LoyaltyManager getLoyaltyManager() {
		return loyaltyManager;
	}

	public ArrayList<String> getPasswordList() {
		return passwordList;
	}

	public ArrayList<String> getIPList() {
		return ipList;
	}

	public void setRights(int rights) {
		this.rights = rights;
	}

	public int getRights() {
		return rights;
	}

	public int firstColumn = 1, secondColumn = 1, thirdColumn = 1;

	public int getFirstColumn() {
		return this.firstColumn;
	}

	public int getSecondColumn() {
		return this.secondColumn;
	}

	public int getThirdColumn() {
		return this.thirdColumn;
	}

	public void setFirstColumn(int i) {
		this.firstColumn = i;
	}

	public void setSecondColumn(int i) {
		this.secondColumn = i;
	}

	public void setThirdColumn(int i) {
		this.thirdColumn = i;
	}

	public int getMessageIcon() {
		return getRights() == 2 || getRights() == 1 ? getRights()
				: isForumModerator() ? 10 : isSupporter() ? 16
						: isGraphicDesigner() ? 9 : isVIPDonator() ? 18
								: isExtremeDonator() ? 11
										: isSuperDonator() ? 17
												: isDonator() ? 8 : getRights();
	}

	public WorldPacketsEncoder getPackets() {
		return session.getWorldPackets();
	}

	public boolean hasStarted() {
		return started;
	}

	public boolean isRunning() {
		return running;
	}

	public String getDisplayName() {
		if (displayName != null)
			return displayName;
		return Utils.formatPlayerNameForDisplay(username);
	}

	public boolean hasDisplayName() {
		return displayName != null;
	}

	public Appearence getAppearence() {
		return appearence;
	}

	public Equipment getEquipment() {
		return equipment;
	}

	@SuppressWarnings("deprecation")
	public void setStarBanking(int minuetes) {
		Date date = new Date(shootingStarBankingTill);
		date.setDate(date.getMinutes() + minuetes);
		shootingStarBankingTill = date.getTime();
	}

	public int getTemporaryMoveType() {
		return temporaryMovementType;
	}

	public void setTemporaryMoveType(int temporaryMovementType) {
		this.temporaryMovementType = temporaryMovementType;
	}

	public LocalPlayerUpdate getLocalPlayerUpdate() {
		return localPlayerUpdate;
	}

	public LocalNPCUpdate getLocalNPCUpdate() {
		return localNPCUpdate;
	}

	public int getDisplayMode() {
		return displayMode;
	}

	public InterfaceManager getInterfaceManager() {
		return interfaceManager;
	}
	
	public static XiduthManagement getXiduthManagement() {
		return xiduthManagement;
	}


	public GodWars getGodWars() {
		return godWars;
	}

	public void setPacketsDecoderPing(long packetsDecoderPing) {
		this.packetsDecoderPing = packetsDecoderPing;
	}

	public long getPacketsDecoderPing() {
		return packetsDecoderPing;
	}

	public Session getSession() {
		return session;
	}

	public void setScreenWidth(int screenWidth) {
		this.screenWidth = screenWidth;
	}

	public int getScreenWidth() {
		return screenWidth;
	}

	public void setScreenHeight(int screenHeight) {
		this.screenHeight = screenHeight;
	}

	public int getScreenHeight() {
		return screenHeight;
	}

	public boolean clientHasLoadedMapRegion() {
		return clientLoadedMapRegion;
	}

	public void setClientHasLoadedMapRegion() {
		clientLoadedMapRegion = true;
	}

	public void setDisplayMode(int displayMode) {
		this.displayMode = displayMode;
	}

	public Inventory getInventory() {
		return inventory;
	}

	public Skills getSkills() {
		return skills;
	}

	public byte getRunEnergy() {
		return runEnergy;
	}

	public void drainRunEnergy() {
		if (isExtremeDonator() || isVIPDonator())
			return;
		setRunEnergy(runEnergy - 1);
	}

	public void setRunEnergy(int runEnergy) {
		this.runEnergy = (byte) runEnergy;
		getPackets().sendRunEnergy();
	}

	public boolean isResting() {
		return resting;
	}

	public void setResting(boolean resting) {
		this.resting = resting;
		sendRunButtonConfig();
	}

	public ActionManager getActionManager() {
		return actionManager;
	}

	public void setCoordsEvent(CoordsEvent coordsEvent) {
		this.coordsEvent = coordsEvent;
	}

	public DialogueManager getDialogueManager() {
		return dialogueManager;
	}

	public SquealOfFortune getSquealOfFortune() {
		return sof;
	}

	public CombatDefinitions getCombatDefinitions() {
		return combatDefinitions;
	}

	public TimeManager getTimeManager() {
		return timeManager;
	}

	@Override
	public double getMagePrayerMultiplier() {
		return 0.6;
	}

	@Override
	public double getRangePrayerMultiplier() {
		return 0.6;
	}

	@Override
	public double getMeleePrayerMultiplier() {
		return 0.6;
	}

	public int getZamorakKC() {
		return ZamorakKC;
	}

	public void resetZamorakKC() {
		setZamorakKC(0);
		getInterfaceManager().updateGWDKC();
	}

	public void setZamorakKC(int ZamorakKC) {
		this.ZamorakKC = ZamorakKC;
	}

	public int getArmadylKC() {
		return ArmadylKC;
	}

	public void resetArmadyl() {
		setArmadylKC(0);
		getInterfaceManager().updateGWDKC();
	}

	public void setArmadylKC(int ArmadylKC) {
		this.ArmadylKC = ArmadylKC;
	}

	public int getSaradominKC() {
		return SaradominKC;
	}

	public void resetSaradominKC() {
		setSaradominKC(0);
		getInterfaceManager().updateGWDKC();
	}

	public void setSaradominKC(int SaradominKC) {
		this.SaradominKC = SaradominKC;
	}

	public void sendSoulSplit(final Hit hit, final Entity user) {
		final Player target = this;
		if (hit.getDamage() > 0)
			World.sendProjectile(user, this, 2263, 11, 11, 20, 5, 0, 0);
		user.heal(hit.getDamage() / 5);
		prayer.drainPrayer(hit.getDamage() / 5);
		WorldTasksManager.schedule(new WorldTask() {
			@Override
			public void run() {
				setNextGraphics(new Graphics(2264));
				if (hit.getDamage() > 0)
					World.sendProjectile(target, user, 2263, 11, 11, 20, 5, 0,
							0);
			}
		}, 0);
	}

	@Override
	public void handleIngoingHit(final Hit hit) {
		if (hit.getLook() != HitLook.MELEE_DAMAGE
				&& hit.getLook() != HitLook.RANGE_DAMAGE
				&& hit.getLook() != HitLook.MAGIC_DAMAGE)
			return;
		if (invulnerable) {
			hit.setDamage(0);
			return;
		}
		if (auraManager.usingPenance()) {
			int amount = (int) (hit.getDamage() * 0.2);
			if (amount > 0)
				prayer.restorePrayer(amount);
		}
		if (disDelay != 0 && disDelay <= Utils.currentTimeMillis()) {
			getPackets().sendGameMessage(
					"The Disruption Shield effect slowly fades away.");
			disDelay = 0;
		}
		if (disDelay > Utils.currentTimeMillis())
			hit.setDamage((int) (hit.getDamage() * 0));
		Entity source = hit.getSource();
		if (source == null)
			return;
		if (polDelay > Utils.currentTimeMillis())
			hit.setDamage((int) (hit.getDamage() * 0.5));
		if (prayer.hasPrayersOn() && hit.getDamage() != 0) {
			if (hit.getLook() == HitLook.MAGIC_DAMAGE) {
				if (prayer.usingPrayer(0, 17))
					hit.setDamage((int) (hit.getDamage() * source
							.getMagePrayerMultiplier()));
				else if (prayer.usingPrayer(1, 7)) {
					int deflectedDamage = source instanceof Nex ? 0
							: (int) (hit.getDamage() * 0.1);
					hit.setDamage((int) (hit.getDamage() * source
							.getMagePrayerMultiplier()));
					if (deflectedDamage > 0) {
						source.applyHit(new Hit(this, deflectedDamage,
								HitLook.REFLECTED_DAMAGE));
						setNextGraphics(new Graphics(2228));
						setNextAnimation(new Animation(12573));
					}
				}
			} else if (hit.getLook() == HitLook.RANGE_DAMAGE) {
				if (prayer.usingPrayer(0, 18))
					hit.setDamage((int) (hit.getDamage() * source
							.getRangePrayerMultiplier()));
				else if (prayer.usingPrayer(1, 8)) {
					int deflectedDamage = source instanceof Nex ? 0
							: (int) (hit.getDamage() * 0.1);
					hit.setDamage((int) (hit.getDamage() * source
							.getRangePrayerMultiplier()));
					if (deflectedDamage > 0) {
						source.applyHit(new Hit(this, deflectedDamage,
								HitLook.REFLECTED_DAMAGE));
						setNextGraphics(new Graphics(2229));
						setNextAnimation(new Animation(12573));
					}
				}
			} else if (hit.getLook() == HitLook.MELEE_DAMAGE) {
				if (prayer.usingPrayer(0, 19))
					hit.setDamage((int) (hit.getDamage() * source
							.getMeleePrayerMultiplier()));
				else if (prayer.usingPrayer(1, 9)) {
					int deflectedDamage = source instanceof Nex ? 0
							: (int) (hit.getDamage() * 0.1);
					hit.setDamage((int) (hit.getDamage() * source
							.getMeleePrayerMultiplier()));
					if (deflectedDamage > 0) {
						source.applyHit(new Hit(this, deflectedDamage,
								HitLook.REFLECTED_DAMAGE));
						setNextGraphics(new Graphics(2230));
						setNextAnimation(new Animation(12573));
					}
				}
			}
		}
		if (hit.getDamage() >= 200) {
			if (hit.getLook() == HitLook.MELEE_DAMAGE) {
				int reducedDamage = hit.getDamage()
						* combatDefinitions.getBonuses()[CombatDefinitions.ABSORVE_MELEE_BONUS]
						/ 100;
				if (reducedDamage > 0) {
					hit.setDamage(hit.getDamage() - reducedDamage);
					hit.setSoaking(new Hit(source, reducedDamage,
							HitLook.ABSORB_DAMAGE));
				}
			} else if (hit.getLook() == HitLook.RANGE_DAMAGE) {
				int reducedDamage = hit.getDamage()
						* combatDefinitions.getBonuses()[CombatDefinitions.ABSORVE_RANGE_BONUS]
						/ 100;
				if (reducedDamage > 0) {
					hit.setDamage(hit.getDamage() - reducedDamage);
					hit.setSoaking(new Hit(source, reducedDamage,
							HitLook.ABSORB_DAMAGE));
				}
			} else if (hit.getLook() == HitLook.MAGIC_DAMAGE) {
				int reducedDamage = hit.getDamage()
						* combatDefinitions.getBonuses()[CombatDefinitions.ABSORVE_MAGE_BONUS]
						/ 100;
				if (reducedDamage > 0) {
					hit.setDamage(hit.getDamage() - reducedDamage);
					hit.setSoaking(new Hit(source, reducedDamage,
							HitLook.ABSORB_DAMAGE));
				}
			}
		}
		int shieldId = equipment.getShieldId();
		if (shieldId == 13742) { // elsyian
			if (Utils.getRandom(100) <= 70)
				hit.setDamage((int) (hit.getDamage() * 0.75));
		} else if (shieldId == 13740) { // divine
			int drain = (int) (Math.ceil(hit.getDamage() * 0.3) / 2);
			if (prayer.getPrayerpoints() >= drain) {
				hit.setDamage((int) (hit.getDamage() * 0.70));
				prayer.drainPrayer(drain);
			}
		}
		if (castedVeng && hit.getDamage() >= 4) {
			castedVeng = false;
			setNextForceTalk(new ForceTalk("Taste vengeance!"));
			source.applyHit(new Hit(this, (int) (hit.getDamage() * 0.75),
					HitLook.REGULAR_DAMAGE));
		}
		if (source instanceof Player) {
			final Player p2 = (Player) source;
			if (p2.prayer.hasPrayersOn()) {
				if (p2.prayer.usingPrayer(0, 24)) { // smite
					int drain = hit.getDamage() / 4;
					if (drain > 0)
						prayer.drainPrayer(drain);
				} else {
					if (hit.getDamage() == 0)
						return;
					if (!p2.prayer.isBoostedLeech()) {
						if (hit.getLook() == HitLook.MELEE_DAMAGE) {
							if (p2.prayer.usingPrayer(1, 19)) {
								if (Utils.getRandom(4) == 0) {
									p2.prayer.increaseTurmoilBonus(this);
									p2.prayer.setBoostedLeech(true);
									return;
								}
							} else if (p2.prayer.usingPrayer(1, 1)) { // sap att
								if (Utils.getRandom(4) == 0) {
									if (p2.prayer.reachedMax(0)) {
										p2.getPackets()
												.sendGameMessage(
														"Your opponent has been weakened so much that your sap curse has no effect.",
														true);
									} else {
										p2.prayer.increaseLeechBonus(0);
										p2.getPackets()
												.sendGameMessage(
														"Your curse drains Attack from the enemy, boosting your Attack.",
														true);
									}
									p2.setNextAnimation(new Animation(12569));
									p2.setNextGraphics(new Graphics(2214));
									p2.prayer.setBoostedLeech(true);
									World.sendProjectile(p2, this, 2215, 35,
											35, 20, 5, 0, 0);
									WorldTasksManager.schedule(new WorldTask() {
										@Override
										public void run() {
											setNextGraphics(new Graphics(2216));
										}
									}, 1);
									return;
								}
							} else {
								if (p2.prayer.usingPrayer(1, 10)) {
									if (Utils.getRandom(7) == 0) {
										if (p2.prayer.reachedMax(3)) {
											p2.getPackets()
													.sendGameMessage(
															"Your opponent has been weakened so much that your leech curse has no effect.",
															true);
										} else {
											p2.prayer.increaseLeechBonus(3);
											p2.getPackets()
													.sendGameMessage(
															"Your curse drains Attack from the enemy, boosting your Attack.",
															true);
										}
										p2.setNextAnimation(new Animation(12575));
										p2.prayer.setBoostedLeech(true);
										World.sendProjectile(p2, this, 2231,
												35, 35, 20, 5, 0, 0);
										WorldTasksManager.schedule(new WorldTask() {
											@Override
											public void run() {
												setNextGraphics(new Graphics(
														2232));
											}
										}, 1);
										return;
									}
								}
								if (p2.prayer.usingPrayer(1, 14)) {
									if (Utils.getRandom(7) == 0) {
										if (p2.prayer.reachedMax(7)) {
											p2.getPackets()
													.sendGameMessage(
															"Your opponent has been weakened so much that your leech curse has no effect.",
															true);
										} else {
											p2.prayer.increaseLeechBonus(7);
											p2.getPackets()
													.sendGameMessage(
															"Your curse drains Strength from the enemy, boosting your Strength.",
															true);
										}
										p2.setNextAnimation(new Animation(12575));
										p2.prayer.setBoostedLeech(true);
										World.sendProjectile(p2, this, 2248,
												35, 35, 20, 5, 0, 0);
										WorldTasksManager.schedule(new WorldTask() {
											@Override
											public void run() {
												setNextGraphics(new Graphics(
														2250));
											}
										}, 1);
										return;
									}
								}

							}
						}
						if (hit.getLook() == HitLook.RANGE_DAMAGE) {
							if (p2.prayer.usingPrayer(1, 2)) { // sap range
								if (Utils.getRandom(4) == 0) {
									if (p2.prayer.reachedMax(1)) {
										p2.getPackets()
												.sendGameMessage(
														"Your opponent has been weakened so much that your sap curse has no effect.",
														true);
									} else {
										p2.prayer.increaseLeechBonus(1);
										p2.getPackets()
												.sendGameMessage(
														"Your curse drains Range from the enemy, boosting your Range.",
														true);
									}
									p2.setNextAnimation(new Animation(12569));
									p2.setNextGraphics(new Graphics(2217));
									p2.prayer.setBoostedLeech(true);
									World.sendProjectile(p2, this, 2218, 35,
											35, 20, 5, 0, 0);
									WorldTasksManager.schedule(new WorldTask() {
										@Override
										public void run() {
											setNextGraphics(new Graphics(2219));
										}
									}, 1);
									return;
								}
							} else if (p2.prayer.usingPrayer(1, 11)) {
								if (Utils.getRandom(7) == 0) {
									if (p2.prayer.reachedMax(4)) {
										p2.getPackets()
												.sendGameMessage(
														"Your opponent has been weakened so much that your leech curse has no effect.",
														true);
									} else {
										p2.prayer.increaseLeechBonus(4);
										p2.getPackets()
												.sendGameMessage(
														"Your curse drains Range from the enemy, boosting your Range.",
														true);
									}
									p2.setNextAnimation(new Animation(12575));
									p2.prayer.setBoostedLeech(true);
									World.sendProjectile(p2, this, 2236, 35,
											35, 20, 5, 0, 0);
									WorldTasksManager.schedule(new WorldTask() {
										@Override
										public void run() {
											setNextGraphics(new Graphics(2238));
										}
									});
									return;
								}
							}
						}
						if (hit.getLook() == HitLook.MAGIC_DAMAGE) {
							if (p2.prayer.usingPrayer(1, 3)) { // sap mage
								if (Utils.getRandom(4) == 0) {
									if (p2.prayer.reachedMax(2)) {
										p2.getPackets()
												.sendGameMessage(
														"Your opponent has been weakened so much that your sap curse has no effect.",
														true);
									} else {
										p2.prayer.increaseLeechBonus(2);
										p2.getPackets()
												.sendGameMessage(
														"Your curse drains Magic from the enemy, boosting your Magic.",
														true);
									}
									p2.setNextAnimation(new Animation(12569));
									p2.setNextGraphics(new Graphics(2220));
									p2.prayer.setBoostedLeech(true);
									World.sendProjectile(p2, this, 2221, 35,
											35, 20, 5, 0, 0);
									WorldTasksManager.schedule(new WorldTask() {
										@Override
										public void run() {
											setNextGraphics(new Graphics(2222));
										}
									}, 1);
									return;
								}
							} else if (p2.prayer.usingPrayer(1, 12)) {
								if (Utils.getRandom(7) == 0) {
									if (p2.prayer.reachedMax(5)) {
										p2.getPackets()
												.sendGameMessage(
														"Your opponent has been weakened so much that your leech curse has no effect.",
														true);
									} else {
										p2.prayer.increaseLeechBonus(5);
										p2.getPackets()
												.sendGameMessage(
														"Your curse drains Magic from the enemy, boosting your Magic.",
														true);
									}
									p2.setNextAnimation(new Animation(12575));
									p2.prayer.setBoostedLeech(true);
									World.sendProjectile(p2, this, 2240, 35,
											35, 20, 5, 0, 0);
									WorldTasksManager.schedule(new WorldTask() {
										@Override
										public void run() {
											setNextGraphics(new Graphics(2242));
										}
									}, 1);
									return;
								}
							}
						}

						// overall

						if (p2.prayer.usingPrayer(1, 13)) { // leech defence
							if (Utils.getRandom(10) == 0) {
								if (p2.prayer.reachedMax(6)) {
									p2.getPackets()
											.sendGameMessage(
													"Your opponent has been weakened so much that your leech curse has no effect.",
													true);
								} else {
									p2.prayer.increaseLeechBonus(6);
									p2.getPackets()
											.sendGameMessage(
													"Your curse drains Defence from the enemy, boosting your Defence.",
													true);
								}
								p2.setNextAnimation(new Animation(12575));
								p2.prayer.setBoostedLeech(true);
								World.sendProjectile(p2, this, 2244, 35, 35,
										20, 5, 0, 0);
								WorldTasksManager.schedule(new WorldTask() {
									@Override
									public void run() {
										setNextGraphics(new Graphics(2246));
									}
								}, 1);
								return;
							}
						}

						if (p2.prayer.usingPrayer(1, 15)) {
							if (Utils.getRandom(10) == 0) {
								if (getRunEnergy() <= 0) {
									p2.getPackets()
											.sendGameMessage(
													"Your opponent has been weakened so much that your leech curse has no effect.",
													true);
								} else {
									p2.setRunEnergy(p2.getRunEnergy() > 90 ? 100
											: p2.getRunEnergy() + 10);
									setRunEnergy(p2.getRunEnergy() > 10 ? getRunEnergy() - 10
											: 0);
								}
								p2.setNextAnimation(new Animation(12575));
								p2.prayer.setBoostedLeech(true);
								World.sendProjectile(p2, this, 2256, 35, 35,
										20, 5, 0, 0);
								WorldTasksManager.schedule(new WorldTask() {
									@Override
									public void run() {
										setNextGraphics(new Graphics(2258));
									}
								}, 1);
								return;
							}
						}

						if (p2.prayer.usingPrayer(1, 16)) {
							if (Utils.getRandom(10) == 0) {
								if (combatDefinitions
										.getSpecialAttackPercentage() <= 0) {
									p2.getPackets()
											.sendGameMessage(
													"Your opponent has been weakened so much that your leech curse has no effect.",
													true);
								} else {
									p2.combatDefinitions.restoreSpecialAttack();
									combatDefinitions
											.desecreaseSpecialAttack(10);
								}
								p2.setNextAnimation(new Animation(12575));
								p2.prayer.setBoostedLeech(true);
								World.sendProjectile(p2, this, 2252, 35, 35,
										20, 5, 0, 0);
								WorldTasksManager.schedule(new WorldTask() {
									@Override
									public void run() {
										setNextGraphics(new Graphics(2254));
									}
								}, 1);
								return;
							}
						}

						if (p2.prayer.usingPrayer(1, 4)) { // sap spec
							if (Utils.getRandom(10) == 0) {
								p2.setNextAnimation(new Animation(12569));
								p2.setNextGraphics(new Graphics(2223));
								p2.prayer.setBoostedLeech(true);
								if (combatDefinitions
										.getSpecialAttackPercentage() <= 0) {
									p2.getPackets()
											.sendGameMessage(
													"Your opponent has been weakened so much that your sap curse has no effect.",
													true);
								} else {
									combatDefinitions
											.desecreaseSpecialAttack(10);
								}
								World.sendProjectile(p2, this, 2224, 35, 35,
										20, 5, 0, 0);
								WorldTasksManager.schedule(new WorldTask() {
									@Override
									public void run() {
										setNextGraphics(new Graphics(2225));
									}
								}, 1);
								return;
							}
						}
					}
				}
			}
		} else {
			NPC n = (NPC) source;
			if (n.getId() == 13448)
				sendSoulSplit(hit, n);
		}
	}

	@Override
	public void sendDeath(final Entity source) {
		if (prayer.hasPrayersOn()
				&& getTemporaryAttributtes().get("startedDuel") != Boolean.TRUE) {
			if (prayer.usingPrayer(0, 22)) {
				setNextGraphics(new Graphics(437));
				final Player target = this;
				if (isAtMultiArea()) {
					for (int regionId : getMapRegionsIds()) {
						List<Integer> playersIndexes = World.getRegion(
								regionId).getPlayerIndexes();
						if (playersIndexes != null) {
							for (int playerIndex : playersIndexes) {
								Player player = World.getPlayers().get(
										playerIndex);
								if (player == null
										|| !player.hasStarted()
										|| player.isDead()
										|| player.hasFinished()
										|| !player.withinDistance(this, 1)
										|| !player.isCanPvp()
										|| !target.getControlerManager()
												.canHit(player))
									continue;
								player.applyHit(new Hit(
										target,
										Utils.getRandom((int) (skills
												.getLevelForXp(Skills.PRAYER) * 2.5)),
										HitLook.REGULAR_DAMAGE));
							}
						}
						List<Integer> npcsIndexes = World.getRegion(regionId)
								.getNPCsIndexes();
						if (npcsIndexes != null) {
							for (int npcIndex : npcsIndexes) {
								NPC npc = World.getNPCs().get(npcIndex);
								if (npc == null
										|| npc.isDead()
										|| npc.hasFinished()
										|| !npc.withinDistance(this, 1)
										|| !npc.getDefinitions()
												.hasAttackOption()
										|| !target.getControlerManager()
												.canHit(npc))
									continue;
								npc.applyHit(new Hit(
										target,
										Utils.getRandom((int) (skills
												.getLevelForXp(Skills.PRAYER) * 2.5)),
										HitLook.REGULAR_DAMAGE));
							}
						}
					}
				} else {
					if (source != null && source != this && !source.isDead()
							&& !source.hasFinished()
							&& source.withinDistance(this, 1))
						source.applyHit(new Hit(target, Utils
								.getRandom((int) (skills
										.getLevelForXp(Skills.PRAYER) * 2.5)),
								HitLook.REGULAR_DAMAGE));
				}
				WorldTasksManager.schedule(new WorldTask() {
					@Override
					public void run() {
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX() - 1, target.getY(),
										target.getPlane()));
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX() + 1, target.getY(),
										target.getPlane()));
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX(), target.getY() - 1,
										target.getPlane()));
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX(), target.getY() + 1,
										target.getPlane()));
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX() - 1,
										target.getY() - 1, target.getPlane()));
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX() - 1,
										target.getY() + 1, target.getPlane()));
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX() + 1,
										target.getY() - 1, target.getPlane()));
						World.sendGraphics(target, new Graphics(438),
								new WorldTile(target.getX() + 1,
										target.getY() + 1, target.getPlane()));
					}
				});
			} else if (prayer.usingPrayer(1, 17)) {
				World.sendProjectile(this, new WorldTile(getX() + 2,
						getY() + 2, getPlane()), 2260, 24, 0, 41, 35, 30, 0);
				World.sendProjectile(this, new WorldTile(getX() + 2, getY(),
						getPlane()), 2260, 41, 0, 41, 35, 30, 0);
				World.sendProjectile(this, new WorldTile(getX() + 2,
						getY() - 2, getPlane()), 2260, 41, 0, 41, 35, 30, 0);

				World.sendProjectile(this, new WorldTile(getX() - 2,
						getY() + 2, getPlane()), 2260, 41, 0, 41, 35, 30, 0);
				World.sendProjectile(this, new WorldTile(getX() - 2, getY(),
						getPlane()), 2260, 41, 0, 41, 35, 30, 0);
				World.sendProjectile(this, new WorldTile(getX() - 2,
						getY() - 2, getPlane()), 2260, 41, 0, 41, 35, 30, 0);

				World.sendProjectile(this, new WorldTile(getX(), getY() + 2,
						getPlane()), 2260, 41, 0, 41, 35, 30, 0);
				World.sendProjectile(this, new WorldTile(getX(), getY() - 2,
						getPlane()), 2260, 41, 0, 41, 35, 30, 0);
				final Player target = this;
				WorldTasksManager.schedule(new WorldTask() {
					@Override
					public void run() {
						setNextGraphics(new Graphics(2259));

						if (isAtMultiArea()) {
							for (int regionId : getMapRegionsIds()) {
								List<Integer> playersIndexes = World
										.getRegion(regionId).getPlayerIndexes();
								if (playersIndexes != null) {
									for (int playerIndex : playersIndexes) {
										Player player = World.getPlayers()
												.get(playerIndex);
										if (player == null
												|| !player.hasStarted()
												|| player.isDead()
												|| player.hasFinished()
												|| !player.isCanPvp()
												|| !player.withinDistance(
														target, 2)
												|| !target
														.getControlerManager()
														.canHit(player))
											continue;
										player.applyHit(new Hit(
												target,
												Utils.getRandom((skills
														.getLevelForXp(Skills.PRAYER) * 3)),
												HitLook.REGULAR_DAMAGE));
									}
								}
								List<Integer> npcsIndexes = World.getRegion(
										regionId).getNPCsIndexes();
								if (npcsIndexes != null) {
									for (int npcIndex : npcsIndexes) {
										NPC npc = World.getNPCs()
												.get(npcIndex);
										if (npc == null
												|| npc.isDead()
												|| npc.hasFinished()
												|| !npc.withinDistance(target,
														2)
												|| !npc.getDefinitions()
														.hasAttackOption()
												|| !target
														.getControlerManager()
														.canHit(npc))
											continue;
										npc.applyHit(new Hit(
												target,
												Utils.getRandom((skills
														.getLevelForXp(Skills.PRAYER) * 3)),
												HitLook.REGULAR_DAMAGE));
									}
								}
							}
						} else {
							if (source != null && source != target
									&& !source.isDead()
									&& !source.hasFinished()
									&& source.withinDistance(target, 2))
								source.applyHit(new Hit(
										target,
										Utils.getRandom((skills
												.getLevelForXp(Skills.PRAYER) * 3)),
										HitLook.REGULAR_DAMAGE));
						}

						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() + 2, getY() + 2,
										getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() + 2, getY(), getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() + 2, getY() - 2,
										getPlane()));

						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() - 2, getY() + 2,
										getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() - 2, getY(), getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() - 2, getY() - 2,
										getPlane()));

						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX(), getY() + 2, getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX(), getY() - 2, getPlane()));

						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() + 1, getY() + 1,
										getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() + 1, getY() - 1,
										getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() - 1, getY() + 1,
										getPlane()));
						World.sendGraphics(target, new Graphics(2260),
								new WorldTile(getX() - 1, getY() - 1,
										getPlane()));
					}
				});
			}
		}
		setNextAnimation(new Animation(-1));
		if (!controlerManager.sendDeath())
			return;
		lock(7);
		stopAll();
		if (familiar != null)
			familiar.sendDeath(this);
		WorldTasksManager.schedule(new WorldTask() {
			int loop;

			@Override
			public void run() {
				if (loop == 0) {
					setNextAnimation(new Animation(836));
				} else if (loop == 1) {
					getPackets().sendGameMessage("Oh dear, you have died.");
					KillStreak = 0;
					hasdied = true;
					if (source instanceof Player) {
						Player killer = (Player) source;
						killer.setAttackedByDelay(4);
					}
				} else if (loop == 3) {
					controlerManager.startControler("DeathEvent");
				} else if (loop == 4) {
					getPackets().sendMusicEffect(90);
					stop();
				}
				loop++;
			}
		}, 0, 1);
	}

	@SuppressWarnings("unused")
	private boolean hasdied;
	public boolean accepted;
	public boolean inClanChat;
	public boolean allowsProfanity;
	public boolean isShaking;
	public int inQuest;
	public boolean isInPestControlLobby;
	public boolean isInPestControlGame;
	public int pestDamage;

	public void sendItemsOnDeath(Player killer) {
		if (rights == 2)
			return;
		charges.die();
		auraManager.removeAura();
		CopyOnWriteArrayList<Item> containedItems = new CopyOnWriteArrayList<Item>();
		for (int i = 0; i < 14; i++) {
			if (equipment.getItem(i) != null
					&& equipment.getItem(i).getId() != -1
					&& equipment.getItem(i).getAmount() != -1)
				containedItems.add(new Item(equipment.getItem(i).getId(),
						equipment.getItem(i).getAmount()));
		}
		for (int i = 0; i < 28; i++) {
			if (inventory.getItem(i) != null
					&& inventory.getItem(i).getId() != -1
					&& inventory.getItem(i).getAmount() != -1)
				containedItems.add(new Item(getInventory().getItem(i).getId(),
						getInventory().getItem(i).getAmount()));
		}
		if (containedItems.isEmpty())
			return;
		int keptAmount = 0;
		if (!(controlerManager.getControler() instanceof CorpBeastControler)
				&& !(controlerManager.getControler() instanceof CrucibleControler)) {
			keptAmount = hasSkull() ? 0 : 3;
			if (prayer.usingPrayer(0, 10) || prayer.usingPrayer(1, 0))
				keptAmount++;
		}
		if (donator && Utils.random(2) == 0)
			keptAmount += 1;
		CopyOnWriteArrayList<Item> keptItems = new CopyOnWriteArrayList<Item>();
		Item lastItem = new Item(1, 1);
		for (int i = 0; i < keptAmount; i++) {
			for (Item item : containedItems) {
				int price = item.getDefinitions().getValue();
				if (price >= lastItem.getDefinitions().getValue()) {
					lastItem = item;
				}
			}
			keptItems.add(lastItem);
			containedItems.remove(lastItem);
			lastItem = new Item(1, 1);
		}
		inventory.reset();
		equipment.reset();
		for (Item item : keptItems) {
			getInventory().addItem(item);
		}
		for (Item item : containedItems) {
			World.addGroundItem(item, getLastWorldTile(),
					killer == null ? this : killer, false, 180, true, true);
			LogsManager.saveDeathLogs(this, killer, containedItems);
		}
	}

	public void increaseKillCount(Player killed) {
		killed.deathCount++;
		PkRank.checkRank(killed);
		if (killed.getSession().getIP().equals(getSession().getIP()))
			return;
		killCount++;
		KillStreak++;
		getPackets().sendGameMessage(
				"<col=" + ChatColors.RED + ">Current kill streak: "
						+ KillStreak + ".");
		getPackets().sendGameMessage(
				"<col=ff0000>You have killed " + killed.getDisplayName()
						+ ", you have now " + killCount + " kills.");
		PkRank.checkRank(this);
	}

	public void increaseKillCountSafe(Player killed) {
		PkRank.checkRank(killed);
		if (killed.getSession().getIP().equals(getSession().getIP()))
			return;
		killCount++;
		getPackets().sendGameMessage(
				"<col=ff0000>You have killed " + killed.getDisplayName()
						+ ", you have now " + killCount + " kills.");
		PkRank.checkRank(this);
	}

	public void sendRandomJail(Player p) {
		p.resetWalkSteps();
		switch (Utils.getRandom(3)) {
		case 0:
			p.setNextWorldTile(new WorldTile(3029, 2984, 0));
			break;
		case 1:
			p.setNextWorldTile(new WorldTile(3036, 2985, 0));
			break;
		case 2:
			p.setNextWorldTile(new WorldTile(3039, 2981, 0));
			break;
		case 3:
			p.setNextWorldTile(new WorldTile(3037, 2978, 0));
			break;
		}
	}

	@Override
	public int getSize() {
		return appearence.getSize();
	}

	public boolean isCanPvp() {
		return canPvp;
	}

	public void setCanPvp(boolean canPvp) {
		this.canPvp = canPvp;
		appearence.generateAppearenceData();
		getPackets().sendPlayerOption(canPvp ? "Attack" : "null", 1, true);
		getPackets().sendPlayerUnderNPCPriority(canPvp);
	}

	public Prayer getPrayer() {
		return prayer;
	}

	public long getLockDelay() {
		return lockDelay;
	}

	public boolean isLocked() {
		return lockDelay >= Utils.currentTimeMillis();
	}

	public void lock() {
		lockDelay = Long.MAX_VALUE;
	}

	public void lock(long time) {
		lockDelay = Utils.currentTimeMillis() + (time * 600);
	}

	public void unlock() {
		lockDelay = 0;
	}

	public void useStairs(int emoteId, final WorldTile dest, int useDelay,
			int totalDelay) {
		useStairs(emoteId, dest, useDelay, totalDelay, null);
	}

	public void useStairs(int emoteId, final WorldTile dest, int useDelay,
			int totalDelay, final String message) {
		stopAll();
		lock(totalDelay);
		if (emoteId != -1)
			setNextAnimation(new Animation(emoteId));
		if (useDelay == 0)
			setNextWorldTile(dest);
		else {
			WorldTasksManager.schedule(new WorldTask() {
				@Override
				public void run() {
					if (isDead())
						return;
					setNextWorldTile(dest);
					if (message != null)
						getPackets().sendGameMessage(message);
				}
			}, useDelay - 1);
		}
	}

	public Bank getBank() {
		return bank;
	}

	public ControlerManager getControlerManager() {
		return controlerManager;
	}

	public void switchMouseButtons() {
		mouseButtons = !mouseButtons;
		refreshMouseButtons();
	}

	public void switchAllowChatEffects() {
		allowChatEffects = !allowChatEffects;
		refreshAllowChatEffects();
	}

	public void refreshAllowChatEffects() {
		getPackets().sendConfig(171, allowChatEffects ? 0 : 1);
	}

	public void switchAcceptAid() {
		acceptAid = !acceptAid;
		refreshAcceptAid();
	}

	public void refreshAcceptAid() {
		getPackets().sendConfig(427, acceptAid ? 1 : 0);
	}

	public void refreshMouseButtons() {
		getPackets().sendConfig(170, mouseButtons ? 0 : 1);
	}

	public void refreshPrivateChatSetup() {
		getPackets().sendConfig(287, privateChatSetup);
	}

	public void refreshClanChatSetup() {
		int value = clanChatSetup << 6;
		getPackets().sendConfig(1438, value);
	}

	public void refreshOtherChatsSetup() {
		int value = friendChatSetup << 6;
		getPackets().sendConfig(1438, value);
	}

	public void setPrivateChatSetup(int privateChatSetup) {
		this.privateChatSetup = privateChatSetup;
	}

	public void setClanChatSetup(int clanChatSetup) {
		this.clanChatSetup = clanChatSetup;
	}

	public void removePlayerFromClan(String name) {
		if (clanChat == null)
			return;
		clanChat.kickPlayerFromChat(this, name);
	}

	public void sendClanChatMessage(String message) {
		if (clanChat == null)
			return;
		clanChat.sendMessage(this, message);
	}

	public void sendClanChannel(QuickChatMessage message) {
		if (clanChat == null)
			return;
		clanChat.sendQuickMessage(this, message);
	}

	public Clanchat getClanChat() {
		return clanChat;
	}

	public void setClanchat(Clanchat clanChat) {
		this.clanChat = clanChat;
	}

	public String getClanclanowner() {
		return clanChatOwner;
	}

	public void setClanChatOwner(String clanChatOwner) {
		this.clanChatOwner = clanChatOwner;
	}

	public void setFriendChatSetup(int friendChatSetup) {
		this.friendChatSetup = friendChatSetup;
	}

	public int getPrivateChatSetup() {
		return privateChatSetup;
	}

	public boolean isForceNextMapLoadRefresh() {
		return forceNextMapLoadRefresh;
	}

	public void setForceNextMapLoadRefresh(boolean forceNextMapLoadRefresh) {
		this.forceNextMapLoadRefresh = forceNextMapLoadRefresh;
	}

	public FriendsIgnores getFriendsIgnores() {
		return friendsIgnores;
	}

	/*
	 * do not use this, only used by pm
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	public void out(String text) {
		getPackets().sendGameMessage(text);
	}

	public void out(String text, int delay) {
		out(text);
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	public void addPotDelay(long time) {
		potDelay = time + Utils.currentTimeMillis();
	}

	public long getPotDelay() {
		return potDelay;
	}

	public void addFoodDelay(long time) {
		foodDelay = time + Utils.currentTimeMillis();
	}

	public long getFoodDelay() {
		return foodDelay;
	}

	public long getBoneDelay() {
		return boneDelay;
	}

	public long getStopDelay() {
		return boneDelay;
	}

	public void setBoneDelay(int boneDelay) {
		this.boneDelay = boneDelay;
	}

	public void addBoneDelay(long time) {
		boneDelay = time + Utils.currentTimeMillis();
	}

	public void addPoisonImmune(long time) {
		poisonImmune = time + Utils.currentTimeMillis();
		getPoison().reset();
	}

	public long getPoisonImmune() {
		return poisonImmune;
	}

	public void addFireImmune(long time) {
		fireImmune = time + Utils.currentTimeMillis();
	}

	public long getFireImmune() {
		return fireImmune;
	}

	@Override
	public void heal(int ammount, int extra) {
		super.heal(ammount, extra);
		refreshHitPoints();
	}

	public MusicsManager getMusicsManager() {
		return musicsManager;
	}

	public HintIconsManager getHintIconsManager() {
		return hintIconsManager;
	}

	public boolean isCastVeng() {
		return castedVeng;
	}

	public void setCastVeng(boolean castVeng) {
		this.castedVeng = castVeng;
	}

	public int getKillCount() {
		return killCount;
	}

	public int getBarrowsKillCount() {
		return barrowsKillCount;
	}

	public int setBarrowsKillCount(int barrowsKillCount) {
		return this.barrowsKillCount = barrowsKillCount;
	}

	public int setKillCount(int killCount) {
		return this.killCount = killCount;
	}

	public int getDeathCount() {
		return deathCount;
	}

	public int setDeathCount(int deathCount) {
		return this.deathCount = deathCount;
	}

	public void setCloseInterfacesEvent(Runnable closeInterfacesEvent) {
		this.closeInterfacesEvent = closeInterfacesEvent;
	}

	// slayer masters

	public boolean isTalkedWithKuradal() {
		return talkedWithKuradal;
	}

	public void setTalkedWithKuradal() {
		talkedWithKuradal = true;
	}

	public void falseWithKuradal() {
		talkedWithSpria = false;
	}

	public boolean isTalkedWithSpria() {
		return talkedWithSpria;
	}

	public void setTalkedWithSpria() {
		talkedWithSpria = true;
	}

	public void falseWithSpria() {
		talkedWithSpria = false;
	}

	public boolean isTalkedWithMazchna() {
		return talkedWithMazchna;
	}

	public void setTalkedWithMazchna() {
		talkedWithMazchna = true;
	}

	public void falseWithMazchna() {
		talkedWithMazchna = false;
	}

	// end of slayer masters

	public void setSlayerPoints(int slayerPoints) {
		this.slayerPoints = slayerPoints;
	}

	public int getSlayerPoints() {
		return slayerPoints;
	}

	public void setTask(SlayerTask task) {
		this.task = task;
	}

	public SlayerTask getTask() {
		return task;
	}

	public long getMuted() {
		return muted;
	}

	public void setHasClaimedReward(boolean has) {
		hasClaimedReward = has;
	}

	public boolean hasClaimedReward() {
		return hasClaimedReward;
	}

	public int getLoyaltyPoints() {
		return Loyaltypoints;
	}

	public void setLoyaltyPoints(int Loyaltypoints) {
		this.Loyaltypoints = Loyaltypoints;
	}

	public ShootingStar getShootingStar() {
		return ShootingStar;
	}

	public void setMuted(long muted) {
		this.muted = muted;
	}

	public long getJailed() {
		return jailed;
	}

	public void setJailed(long jailed) {
		this.jailed = jailed;
	}

	public boolean isPermBanned() {
		return permBanned;
	}

	public void setPermBanned(boolean permBanned) {
		this.permBanned = permBanned;
	}

	public long getBanned() {
		return banned;
	}

	public void setBanned(long banned) {
		this.banned = banned;
	}

	public ChargesManager getCharges() {
		return charges;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean[] getKilledBarrowBrothers() {
		return killedBarrowBrothers;
	}

	public void setHiddenBrother(int hiddenBrother) {
		this.hiddenBrother = hiddenBrother;
	}

	public int getHiddenBrother() {
		return hiddenBrother;
	}

	public void resetBarrows() {
		hiddenBrother = -1;
		killedBarrowBrothers = new boolean[7]; // includes new bro for future
		// use
		barrowsKillCount = 0;
	}

	public int getVotes() {
		return votes;
	}

	public void setVotes(int votes) {
		this.votes = votes;
	}

	public boolean isDonator() {
		return isVIPDonator() || isExtremeDonator() || isSuperDonator()
				|| donator || donatorTill > Utils.currentTimeMillis();
	}

	public void setDonator(boolean donator) {
		this.donator = donator;
	}

	public boolean isSuperDonator() {
		return superDonator || superDonatorTill > Utils.currentTimeMillis();
	}

	public boolean isExtremeDonator() {
		return extremeDonator || extremeDonatorTill > Utils.currentTimeMillis();
	}

	public boolean isVIPDonator() {
		return vipDonator || vipDonatorTill > Utils.currentTimeMillis();
	}

	public boolean isExtremePermDonator() {
		return extremeDonator;
	}

	public void setExtremeDonator(boolean extremeDonator) {
		this.extremeDonator = extremeDonator;
	}

	public boolean isSuperPermDonator() {
		return superDonator;
	}

	public void setSuperDonator(boolean superDonator) {
		this.superDonator = superDonator;
	}

	public boolean isVIPPermDonator() {
		return vipDonator;
	}

	public void setVIPDonator(boolean vipDonator) {
		this.vipDonator = vipDonator;
	}

	public boolean isGraphicDesigner() {
		return isGraphicDesigner;
	}

	public boolean isForumModerator() {
		return isForumModerator;
	}

	public void setGraphicDesigner(boolean isGraphicDesigner) {
		this.isGraphicDesigner = isGraphicDesigner;
	}

	public void setForumModerator(boolean isForumModerator) {
		this.isForumModerator = isForumModerator;
	}

	@SuppressWarnings("deprecation")
	public void makeDonator(int months) {
		if (donatorTill < Utils.currentTimeMillis())
			donatorTill = Utils.currentTimeMillis();
		Date date = new Date(donatorTill);
		date.setMonth(date.getMonth() + months);
		donatorTill = date.getTime();
	}

	@SuppressWarnings("deprecation")
	public void makeDonatorDays(int days) {
		if (donatorTill < Utils.currentTimeMillis())
			donatorTill = Utils.currentTimeMillis();
		Date date = new Date(donatorTill);
		date.setDate(date.getDate() + days);
		donatorTill = date.getTime();
	}

	@SuppressWarnings("deprecation")
	public void makeExtremeDonatorDays(int days) {
		if (extremeDonatorTill < Utils.currentTimeMillis())
			extremeDonatorTill = Utils.currentTimeMillis();
		Date date = new Date(extremeDonatorTill);
		date.setDate(date.getDate() + days);
		extremeDonatorTill = date.getTime();
	}

	@SuppressWarnings("deprecation")
	public void makeSuperDonatorDays(int days) {
		if (superDonatorTill < Utils.currentTimeMillis())
			superDonatorTill = Utils.currentTimeMillis();
		Date date = new Date(superDonatorTill);
		date.setDate(date.getDate() + days);
		superDonatorTill = date.getTime();
	}

	@SuppressWarnings("deprecation")
	public void makeVIPDonatorDays(int days) {
		if (vipDonatorTill < Utils.currentTimeMillis())
			vipDonatorTill = Utils.currentTimeMillis();
		Date date = new Date(vipDonatorTill);
		date.setDate(date.getDate() + days);
		vipDonatorTill = date.getTime();
	}

	@SuppressWarnings("deprecation")
	public String getDonatorTill() {
		return (donator ? "never" : new Date(donatorTill).toGMTString()) + ".";
	}

	@SuppressWarnings("deprecation")
	public String getSuperDonatorTill() {
		return (superDonator ? "never" : new Date(superDonatorTill)
				.toGMTString()) + ".";
	}

	@SuppressWarnings("deprecation")
	public String getExtremeDonatorTill() {
		return (extremeDonator ? "never" : new Date(extremeDonatorTill)
				.toGMTString()) + ".";
	}

	@SuppressWarnings("deprecation")
	public String getVIPDonatorTill() {
		return (vipDonator ? "never" : new Date(vipDonatorTill).toGMTString())
				+ ".";
	}

	public String getRecovQuestion() {
		return recovQuestion;
	}

	public void setRecovQuestion(String recovQuestion) {
		this.recovQuestion = recovQuestion;
	}

	public String getRecovAnswer() {
		return recovAnswer;
	}

	public void setRecovAnswer(String recovAnswer) {
		this.recovAnswer = recovAnswer;
	}

	public String getLastMsg() {
		return lastMsg;
	}

	public void setLastMsg(String lastMsg) {
		this.lastMsg = lastMsg;
	}

	public int[] getPouches() {
		return pouches;
	}

	public EmotesManager getEmotesManager() {
		return emotesManager;
	}

	public String getLastIP() {
		return lastIP;
	}

	public String getLastHostname() {
		InetAddress addr;
		try {
			addr = InetAddress.getByName(getLastIP());
			String hostname = addr.getHostName();
			return hostname;
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
		return null;
	}

	public PriceCheckManager getPriceCheckManager() {
		return priceCheckManager;
	}

	public void setPestPoints(int pestPoints) {
		this.pestPoints = pestPoints;
	}

	public int getPestPoints() {
		return pestPoints;
	}

	public void saveLocation(boolean trash) {
		if (trash)
			savedLocation = null;
		else if (!trash) {
			if (controlerManager.getControler() != null
					&& !(getControlerManager().getControler() instanceof BotanyBay)) {
				return;
			}
		}
		savedLocation = new WorldTile(getX(), getY(), getPlane());
	}

	/**
	 * Returns the players saved location.
	 * 
	 * @return - savedLocatiom
	 */
	public WorldTile getSavedLocation() {
		return savedLocation;
	}

	public void addBan_Days(int days) {
		setBanned(Utils.currentTimeMillis() + ((days * 24) * 60 * 60 * 1000));
		getSession().getChannel().disconnect();
	}

	public void addBan_Hours(int hours) {
		setBanned(Utils.currentTimeMillis() + (hours * 60 * 60 * 1000));
		getSession().getChannel().disconnect();
	}

	/**
	 * Teleports a player to their saved location
	 * 
	 * @param delayTime
	 *            - Time in which the player must be teleported
	 * @param event
	 *            - what you want to player to preform before the delay time
	 *            runs out
	 * @param timeEvent
	 *            - true if you want the event to run when the delaytime is
	 *            peaked
	 */
	public void sendToSavedLocation(final int delayTime, final Runnable event) {
		if (savedLocation == null) {
			return;
		}
		if (delayTime < 1) {
			try {
				lock();
				Magic.sendNormalTeleportSpell(this, 0, 0, savedLocation);
				event.run();
				unlock();
			} catch (NullPointerException e) {
				unlock();
			}
		} else if (delayTime > 0) {
			try {
				lock();
				event.run();
				WorldTasksManager.schedule(new WorldTask() {
					int delay;

					@Override
					public void run() {
						if (delay == delayTime)
							unlock();
						setNextWorldTile(savedLocation);
						unlock();
						stop();
						delay++;
					}
				}, 0, 1);
			} catch (NullPointerException e) {
				unlock();
			}
		}
	}

	public boolean isUpdateMovementType() {
		return updateMovementType;
	}

	public long getLastPublicMessage() {
		return lastPublicMessage;
	}

	public void setLastPublicMessage(long lastPublicMessage) {
		this.lastPublicMessage = lastPublicMessage;
	}

	public CutscenesManager getCutscenesManager() {
		return cutscenesManager;
	}

	public void kickPlayerFromFriendsChannel(String name) {
		if (currentFriendChat == null)
			return;
		currentFriendChat.kickPlayerFromChat(this, name);
	}

	public void sendFriendsChannelMessage(String message) {
		if (currentFriendChat == null)
			return;
		currentFriendChat.sendMessage(this, message);
	}

	public void sendFriendsChannelQuickMessage(QuickChatMessage message) {
		if (currentFriendChat == null)
			return;
		currentFriendChat.sendQuickMessage(this, message);
	}

	public void sendPublicChatMessage(PublicChatMessage message) {
		for (int regionId : getMapRegionsIds()) {
			List<Integer> playersIndexes = World.getRegion(regionId)
					.getPlayerIndexes();
			if (playersIndexes == null)
				continue;
			for (Integer playerIndex : playersIndexes) {
				Player p = World.getPlayers().get(playerIndex);
				if (p == null
						|| !p.hasStarted()
						|| p.hasFinished()
						|| p.getLocalPlayerUpdate().getLocalPlayers()[getIndex()] == null)
					continue;
				p.getPackets().sendPublicMessage(this, message);
			}
		}
	}

	public int[] getCompletionistCapeCustomized() {
		return completionistCapeCustomized;
	}

	public void setCompletionistCapeCustomized(int[] skillcapeCustomized) {
		this.completionistCapeCustomized = skillcapeCustomized;
	}

	public int[] getMaxedCapeCustomized() {
		return maxedCapeCustomized;
	}

	public void setMaxedCapeCustomized(int[] maxedCapeCustomized) {
		this.maxedCapeCustomized = maxedCapeCustomized;
	}

	public void setSkullId(int skullId) {
		this.skullId = skullId;
	}

	public int getSkullId() {
		return skullId;
	}

	public boolean isFilterGame() {
		return filterGame;
	}

	public void setFilterGame(boolean filterGame) {
		this.filterGame = filterGame;
	}

	public void addLogicPacketToQueue(LogicPacket packet) {
		for (LogicPacket p : logicPackets) {
			if (p.getId() == packet.getId()) {
				logicPackets.remove(p);
				break;
			}
		}
		logicPackets.add(packet);
	}

	public DominionTower getDominionTower() {
		return dominionTower;
	}

	public Farming getFarming() {
		return farming;
	}

	public void setPrayerRenewalDelay(int delay) {
		this.prayerRenewalDelay = delay;
	}

	public int getOverloadDelay() {
		return overloadDelay;
	}

	public void setOverloadDelay(int overloadDelay) {
		this.overloadDelay = overloadDelay;
	}

	public Trade getTrade() {
		return trade;
	}

	public void setTeleBlockDelay(long teleDelay) {
		getTemporaryAttributtes().put("TeleBlocked",
				teleDelay + Utils.currentTimeMillis());
	}

	public long getTeleBlockDelay() {
		Long teleblock = (Long) getTemporaryAttributtes().get("TeleBlocked");
		if (teleblock == null)
			return 0;
		return teleblock;
	}

	public void setPrayerDelay(long teleDelay) {
		getTemporaryAttributtes().put("PrayerBlocked",
				teleDelay + Utils.currentTimeMillis());
		prayer.closeAllPrayers();
	}

	public long getPrayerDelay() {
		Long teleblock = (Long) getTemporaryAttributtes().get("PrayerBlocked");
		if (teleblock == null)
			return 0;
		return teleblock;
	}

	public void setTrollPoints(int trollPoints) {
		this.trollPoints = trollPoints;
	}

	public int getTrollPoints() {
		return trollPoints;
	}

	public void setDungTokens(int DungTokens) {
		this.DungTokens = DungTokens;
	}

	public int getDungTokens() {
		return DungTokens;
	}

	public void setPvMPoints(int PvMPoints) {
		this.PvMPoints = PvMPoints;
	}

	public int getPvMPoints() {
		return PvMPoints;
	}

	public long getDisDelay() {
		return disDelay;
	}

	public void addDisDelay(long delay) {
		disDelay = delay + Utils.currentTimeMillis();
	}

	public void setDisDelay(long delay) {
		this.disDelay = delay;
	}

	public void setDP(int DP) {
		this.DP = DP;
	}

	public int getDP() {
		return DP;
	}

	public int getGlacorFreeze() {
		return GlacorFreeze;
	}

	public void setGlacorFreeze(int glacorFreeze) {
		GlacorFreeze = glacorFreeze;
	}

	public boolean isGlacorFree() {
		return GlacorFree;
	}

	public void setGlacorFree(boolean glacorFree) {
		GlacorFree = glacorFree;
	}

	public Familiar getFamiliar() {
		return familiar;
	}

	public void setFamiliar(Familiar familiar) {
		this.familiar = familiar;
	}

	public FriendChatsManager getCurrentFriendChat() {
		return currentFriendChat;
	}

	public void setCurrentFriendChat(FriendChatsManager currentFriendChat) {
		this.currentFriendChat = currentFriendChat;
	}

	public String getCurrentFriendChatOwner() {
		return currentFriendChatOwner;
	}

	public void setCurrentFriendChatOwner(String currentFriendChatOwner) {
		this.currentFriendChatOwner = currentFriendChatOwner;
	}

	public int getSummoningLeftClickOption() {
		return summoningLeftClickOption;
	}

	public void setSummoningLeftClickOption(int summoningLeftClickOption) {
		this.summoningLeftClickOption = summoningLeftClickOption;
	}

	public boolean canSpawn() {
		if (Wilderness.isAtWild(this)
				|| getControlerManager().getControler() instanceof FightPitsArena
				|| getControlerManager().getControler() instanceof CorpBeastControler
				|| getControlerManager().getControler() instanceof ZGDControler
				|| getControlerManager().getControler() instanceof GodWars
				|| getControlerManager().getControler() instanceof DTControler
				|| getControlerManager().getControler() instanceof DuelArena
				|| getControlerManager().getControler() instanceof CastleWarsPlaying
				|| getControlerManager().getControler() instanceof CastleWarsWaiting
				|| getControlerManager().getControler() instanceof FightCaves
				|| getControlerManager().getControler() instanceof FightKiln
				|| getControlerManager().getControler() instanceof RuneDungGame
				|| getControlerManager().getControler() instanceof Wilderness
				|| FfaZone.inPvpArea(this)
				|| getControlerManager().getControler() instanceof NomadsRequiem
				|| getControlerManager().getControler() instanceof QueenBlackDragonController
				|| getControlerManager().getControler() instanceof WarControler) {
			return false;
		}
		if (getControlerManager().getControler() instanceof CrucibleControler) {
			CrucibleControler controler = (CrucibleControler) getControlerManager()
					.getControler();
			return !controler.isInside();
		}
		return true;
	}

	public long getPolDelay() {
		return polDelay;
	}

	public void addPolDelay(long delay) {
		polDelay = delay + Utils.currentTimeMillis();
	}

	public void setPolDelay(long delay) {
		this.polDelay = delay;
	}

	public List<Integer> getSwitchItemCache() {
		return switchItemCache;
	}

	public void setHelpedWithStar(boolean i) {
		helpedWithStar = i;
	}

	public boolean getHelpedWithStar() {
		return helpedWithStar;
	}

	public AuraManager getAuraManager() {
		return auraManager;
	}

	public int getMovementType() {
		if (getTemporaryMoveType() != -1)
			return getTemporaryMoveType();
		return getRun() ? RUN_MOVE_TYPE : WALK_MOVE_TYPE;
	}

	public List<String> getOwnedObjectManagerKeys() {
		if (ownedObjectsManagerKeys == null) // temporary
			ownedObjectsManagerKeys = new LinkedList<String>();
		return ownedObjectsManagerKeys;
	}

	public boolean hasInstantSpecial(final int weaponId) {
		switch (weaponId) {
		case 4153:
		case 15486:
		case 22207:
		case 22209:
		case 22211:
		case 22213:
		case 1377:
		case 13472:
		case 35:// Excalibur
		case 8280:
		case 14632:
			return true;
		default:
			return false;
		}
	}

	public void performInstantSpecial(final int weaponId) {
		int specAmt = PlayerCombat.getSpecialAmmount(weaponId);
		if (combatDefinitions.hasRingOfVigour())
			specAmt *= 0.9;
		if (combatDefinitions.getSpecialAttackPercentage() < specAmt) {
			getPackets().sendGameMessage("You don't have enough power left.");
			combatDefinitions.desecreaseSpecialAttack(0);
			return;
		}
		if (this.getSwitchItemCache().size() > 0) {
			ButtonHandler.submitSpecialRequest(this);
			return;
		}
		switch (weaponId) {
		case 4153:
			combatDefinitions.setInstantAttack(true);
			combatDefinitions.switchUsingSpecialAttack();
			Entity target = (Entity) getTemporaryAttributtes().get(
					"last_target");
			if (target != null
					&& target.getTemporaryAttributtes().get("last_attacker") == this) {
				if (!(getActionManager().getAction() instanceof PlayerCombat)
						|| ((PlayerCombat) getActionManager().getAction())
								.getTarget() != target) {
					getActionManager().setAction(new PlayerCombat(target));
				}
			}
			break;
		case 1377:
		case 13472:
			setNextAnimation(new Animation(1056));
			setNextGraphics(new Graphics(246));
			setNextForceTalk(new ForceTalk("Raarrrrrgggggghhhhhhh!"));
			int defence = (int) (skills.getLevelForXp(Skills.DEFENCE) * 0.90D);
			int attack = (int) (skills.getLevelForXp(Skills.ATTACK) * 0.90D);
			int range = (int) (skills.getLevelForXp(Skills.RANGE) * 0.90D);
			int magic = (int) (skills.getLevelForXp(Skills.MAGIC) * 0.90D);
			int strength = (int) (skills.getLevelForXp(Skills.STRENGTH) * 1.2D);
			skills.set(Skills.DEFENCE, defence);
			skills.set(Skills.ATTACK, attack);
			skills.set(Skills.RANGE, range);
			skills.set(Skills.MAGIC, magic);
			skills.set(Skills.STRENGTH, strength);
			combatDefinitions.desecreaseSpecialAttack(specAmt);
			break;
		case 35:// Excalibur
		case 8280:
		case 14632:
			setNextAnimation(new Animation(1168));
			setNextGraphics(new Graphics(247));
			setNextForceTalk(new ForceTalk("For " + Settings.SERVER_NAME + "!"));
			final boolean enhanced = weaponId == 14632;
			skills.set(
					Skills.DEFENCE,
					enhanced ? (int) (skills.getLevelForXp(Skills.DEFENCE) * 1.15D)
							: (skills.getLevel(Skills.DEFENCE) + 8));
			WorldTasksManager.schedule(new WorldTask() {
				int count = 5;

				@Override
				public void run() {
					if (isDead() || hasFinished()
							|| getHitpoints() >= getMaxHitpoints()) {
						stop();
						return;
					}
					heal(enhanced ? 80 : 40);
					if (count-- == 0) {
						stop();
						return;
					}
				}
			}, 4, 2);
			combatDefinitions.desecreaseSpecialAttack(specAmt);
			break;
		case 15486:
		case 22207:
		case 22209:
		case 22211:
		case 22213:
			setNextAnimation(new Animation(12804));
			setNextGraphics(new Graphics(2319));// 2320
			setNextGraphics(new Graphics(2321));
			addPolDelay(60000);
			combatDefinitions.desecreaseSpecialAttack(specAmt);
			break;
		}
	}

	public void setDisableEquip(boolean equip) {
		disableEquip = equip;
	}

	public boolean isEquipDisabled() {
		return disableEquip;
	}

	public void addDisplayTime(long i) {
		this.displayTime = i + Utils.currentTimeMillis();
	}

	public long getDisplayTime() {
		return displayTime;
	}

	public int getPublicStatus() {
		return publicStatus;
	}

	public void setPublicStatus(int publicStatus) {
		this.publicStatus = publicStatus;
	}

	public int getClanStatus() {
		return clanStatus;
	}

	public void setClanStatus(int clanStatus) {
		this.clanStatus = clanStatus;
	}

	public void setSpins(int spins) {
		this.spins = spins;
		getSquealOfFortune().showSpins();
	}

	public enum AlchType {
		HIGH, LOW
	}

	public AlchType getAlchType() {
		return alchType;
	}

	public void setAlchType(AlchType alchType) {
		this.alchType = alchType;
	}

	public int getSpins() {
		return spins;
	}

	public int getTradeStatus() {
		return tradeStatus;
	}

	public void setTradeStatus(int tradeStatus) {
		this.tradeStatus = tradeStatus;
	}

	public int getAssistStatus() {
		return assistStatus;
	}

	public void setAssistStatus(int assistStatus) {
		this.assistStatus = assistStatus;
	}

	public boolean isSpawnsMode() {
		return spawnsMode;
	}

	public void setSpawnsMode(boolean spawnsMode) {
		this.spawnsMode = spawnsMode;
	}

	public Notes getNotes() {
		return notes;
	}

	public IsaacKeyPair getIsaacKeyPair() {
		return isaacKeyPair;
	}

	public QuestManager getQuestManager() {
		return questManager;
	}

	public boolean isCompletedFightCaves() {
		return completedFightCaves;
	}

	public void setCompletedFightCaves() {
		if (!completedFightCaves) {
			completedFightCaves = true;
			refreshFightKilnEntrance();
		}
	}

	public boolean isCompletedFightKiln() {
		return completedFightKiln;
	}

	public boolean isKilledQBD() {
		return killedQBD;
	}

	public void setKilledQBD() {
		killedQBD = true;
	}

	public void setCompletedFightKiln() {
		completedFightKiln = true;
	}

	public boolean isWonFightPits() {
		return wonFightPits;
	}

	public void setWonFightPits() {
		wonFightPits = true;
	}

	public boolean isCantTrade() {
		return cantTrade;
	}

	public void setCantTrade(boolean canTrade) {
		this.cantTrade = canTrade;
	}

	public String getYellColor() {
		return yellColor;
	}

	public void setYellColor(String yellColor) {
		this.yellColor = yellColor;
	}

	public int getTrollsKilled() {
		return trollsKilled;
	}

	public int getTrollsToKill() {
		return trollsToKill;
	}

	public Pet getPet() {
		return pet;
	}

	public void setPet(Pet pet) {
		this.pet = pet;
	}

	public boolean isSupporter() {
		return isSupporter;
	}

	public void setSupporter(boolean isSupporter) {
		this.isSupporter = isSupporter;
	}

	public SlayerTask getSlayerTask() {
		return slayerTask;
	}

	public void setSlayerTask(SlayerTask slayerTask) {
		this.slayerTask = slayerTask;
	}

	/**
	 * Gets the petManager.
	 * 
	 * @return The petManager.
	 */
	public PetManager getPetManager() {
		return petManager;
	}

	/**
	 * Sets the petManager.
	 * 
	 * @param petManager
	 *            The petManager to set.
	 */
	public void setPetManager(PetManager petManager) {
		this.petManager = petManager;
	}

	public boolean isXpLocked() {
		return xpLocked;
	}

	public void setXpLocked(boolean locked) {
		this.xpLocked = locked;
	}

	public int getLastBonfire() {
		return lastBonfire;
	}

	public void setLastBonfire(int lastBonfire) {
		this.lastBonfire = lastBonfire;
	}

	public boolean isYellOff() {
		return yellOff;
	}

	public void setYellOff(boolean yellOff) {
		this.yellOff = yellOff;
	}

	public int setTrollsKilled(int trollsKilled) {
		return (this.trollsKilled = trollsKilled);
	}

	public int setTrollsToKill(int toKill) {
		return (this.trollsToKill = toKill);
	}

	public void addTrollKill() {
		trollsKilled++;
	}

	public void setInvulnerable(boolean invulnerable) {
		this.invulnerable = invulnerable;
	}

	public double getHpBoostMultiplier() {
		return hpBoostMultiplier;
	}

	public void setHpBoostMultiplier(double hpBoostMultiplier) {
		this.hpBoostMultiplier = hpBoostMultiplier;
	}

	public void sm(String message) {
		getPackets().sendGameMessage(message);
	}
	
	public void sgm(String message) {
		getPackets().sendGameMessage(message);
	}

	public CrystalChest getCrystalChest() {
		return crystalChest;
	}

	/**
	 * Gets the killedQueenBlackDragon.
	 * 
	 * @return The killedQueenBlackDragon.
	 */
	public boolean isKilledQueenBlackDragon() {
		return killedQueenBlackDragon;
	}

	/**
	 * Sets the killedQueenBlackDragon.
	 * 
	 * @param killedQueenBlackDragon
	 *            The killedQueenBlackDragon to set.
	 */
	public void setKilledQueenBlackDragon(boolean killedQueenBlackDragon) {
		this.killedQueenBlackDragon = killedQueenBlackDragon;
	}

	public boolean hasLargeSceneView() {
		return largeSceneView;
	}

	public void setLargeSceneView(boolean largeSceneView) {
		this.largeSceneView = largeSceneView;
	}

	public boolean isOldItemsLook() {
		return oldItemsLook;
	}

	public void switchItemsLook() {
		oldItemsLook = !oldItemsLook;
		getPackets().sendItemsLook();
	}

	/**
	 * @return the runeSpanPoint
	 */
	public int getRuneSpanPoints() {
		return runeSpanPoints;
	}

	/**
	 * @param runeSpanPoint
	 *            the runeSpanPoint to set
	 */
	public void setRuneSpanPoint(int runeSpanPoints) {
		this.runeSpanPoints = runeSpanPoints;
	}

	/**
	 * Adds points
	 * 
	 * @param points
	 */
	public void addRunespanPoints(int points) {
		this.runeSpanPoints += points;
	}

	/**
	 * Warriors Guild Stuff
	 */

	public int getWGuildTokens() {
		return wGuildTokens;
	}

	public void setWGuildTokens(int tokens) {
		wGuildTokens = tokens;
	}

	public boolean inClopsRoom() {
		return inClops;
	}

	public void setInClopsRoom(boolean in) {
		inClops = in;
	}

	public DuelRules getLastDuelRules() {
		return lastDuelRules;
	}

	public void setLastDuelRules(DuelRules duelRules) {
		this.lastDuelRules = duelRules;
	}

	public boolean isTalkedWithMarv() {
		return talkedWithMarv;
	}

	public void setTalkedWithMarv() {
		talkedWithMarv = true;
	}

	public int getCrucibleHighScore() {
		return crucibleHighScore;
	}

	public void increaseCrucibleHighScore() {
		crucibleHighScore++;
	}

	public void setVoted(long ms) {
		voted = ms + Utils.currentTimeMillis();
	}

	public boolean hasVoted() {
		return isDonator() || voted > Utils.currentTimeMillis();
	}

	public int getLastLoggedIn() {
		return lastlogged;
	}

	/**
	 * MoneyPouch Stuff
	 */

	public double getMoneyInPouch() {
		return moneyInPouch;
	}

	public void setMoneyInPouch(int totalCash) {
		moneyInPouch = totalCash;
	}

	public void addMoneyToPouch(int add) {
		moneyInPouch += add;
	}

	public void removeMoneyFromPouch(int remove) {
		moneyInPouch -= remove;
	}

	public void moneyPouchPow(int power) {
		moneyInPouch = Math.pow(moneyInPouch, power);
	}

	public MoneyPouch getMoneyPouch() {
		return moneyPouch;
	}

	public Lottery getLottery() {
		return lottery;
	}

	/**
	 * 
	 * Lootshare.
	 * 
	 */

	public boolean lootshareEnabled() {
		return this.lootshareEnabled;
	}

	public void toggleLootShare() {
		this.lootshareEnabled = !this.lootshareEnabled;
		getPackets().sendConfig(1083, this.lootshareEnabled ? 1 : 0);
		sendMessage(String.format(
				"<col=115b0d>Lootshare is now %sactive!</col>",
				this.lootshareEnabled ? "" : "in"));
	}

	/**
	 * 
	 * Player data.
	 * 
	 */

	public PlayerData getPlayerData() {
		return playerData;
	}

	public void setPlayerData(PlayerData playerData) {
		this.playerData = playerData;
	}

	public int getGESlot() {
		return GESlot;
	}

	public void setGESlot(int gESlot) {
		GESlot = gESlot;
	}

	public ItemOffer[] getGeOffers() {
		return geOffers;
	}

	public void setGeOffers(ItemOffer[] geOffers) {
		this.geOffers = geOffers;
	}

	public void sendMessage(String message) {
		getPackets().sendGameMessage(message);
	}

	public Object checkForItem(int i) {
		return null;
	}

	/**
	 * Farming Methods
	 */

	// Falador
	public int getFaladorHerbPatch() {
		return faladorHerbPatch;
	}

	public void setFaladorHerbPatch(int seed) {
		this.faladorHerbPatch = seed;
	}

	public int getFaladorNorthAllotmentPatch() {
		return faladorNorthAllotmentPatch;
	}

	public void setFaladorNorthAllotmentPatch(int seed) {
		this.faladorNorthAllotmentPatch = seed;
	}

	public int getFaladorSouthAllotmentPatch() {
		return faladorSouthAllotmentPatch;
	}

	public void setFaladorSouthAllotmentPatch(int seed) {
		this.faladorSouthAllotmentPatch = seed;
	}

	public int getFaladorFlowerPatch() {
		return faladorFlowerPatch;
	}

	public void setFaladorFlowerPatch(int seed) {
		this.faladorFlowerPatch = seed;
	}

	public boolean getFaladorHerbPatchRaked() {
		return faladorHerbPatchRaked;
	}

	public void setFaladorHerbPatchRaked(boolean raked) {
		this.faladorHerbPatchRaked = raked;
	}

	public boolean getFaladorNorthAllotmentPatchRaked() {
		return faladorNorthAllotmentPatchRaked;
	}

	public void setFaladorNorthAllotmentPatchRaked(boolean raked) {
		this.faladorNorthAllotmentPatchRaked = raked;
	}

	public boolean getFaladorSouthAllotmentPatchRaked() {
		return faladorSouthAllotmentPatchRaked;
	}

	public void setFaladorSouthAllotmentPatchRaked(boolean raked) {
		this.faladorSouthAllotmentPatchRaked = raked;
	}

	public boolean getFaladorFlowerPatchRaked() {
		return faladorFlowerPatchRaked;
	}

	public void setFaladorFlowerPatchRaked(boolean raked) {
		this.faladorFlowerPatchRaked = raked;
	}

	// Ardougne
	public int getArdougneHerbPatch() {
		return ardougneHerbPatch;
	}

	public void setArdougneHerbPatch(int seed) {
		this.ardougneHerbPatch = seed;
	}

	public int getArdougneNorthAllotmentPatch() {
		return ardougneNorthAllotmentPatch;
	}

	public void setArdougneNorthAllotmentPatch(int seed) {
		this.ardougneNorthAllotmentPatch = seed;
	}

	public int getArdougneSouthAllotmentPatch() {
		return ardougneSouthAllotmentPatch;
	}

	public void setArdougneSouthAllotmentPatch(int seed) {
		this.ardougneSouthAllotmentPatch = seed;
	}

	public int getArdougneFlowerPatch() {
		return ardougneFlowerPatch;
	}

	public void setArdougneFlowerPatch(int seed) {
		this.ardougneFlowerPatch = seed;
	}

	public boolean getArdougneHerbPatchRaked() {
		return ardougneHerbPatchRaked;
	}

	public void setArdougneHerbPatchRaked(boolean raked) {
		this.ardougneHerbPatchRaked = raked;
	}

	public boolean getArdougneNorthAllotmentPatchRaked() {
		return ardougneNorthAllotmentPatchRaked;
	}

	public void setArdougneNorthAllotmentPatchRaked(boolean raked) {
		this.ardougneNorthAllotmentPatchRaked = raked;
	}

	public boolean getArdougneSouthAllotmentPatchRaked() {
		return ardougneSouthAllotmentPatchRaked;
	}

	public void setArdougneSouthAllotmentPatchRaked(boolean raked) {
		this.ardougneSouthAllotmentPatchRaked = raked;
	}

	public boolean getArdougneFlowerPatchRaked() {
		return ardougneFlowerPatchRaked;
	}

	public void setArdougneFlowerPatchRaked(boolean raked) {
		this.ardougneFlowerPatchRaked = raked;
	}

	// Catherby
	public int getCatherbyHerbPatch() {
		return catherbyHerbPatch;
	}

	public void setCatherbyHerbPatch(int seed) {
		this.catherbyHerbPatch = seed;
	}

	public int getCatherbyNorthAllotmentPatch() {
		return catherbyNorthAllotmentPatch;
	}

	public void setCatherbyNorthAllotmentPatch(int seed) {
		this.catherbyNorthAllotmentPatch = seed;
	}

	public int getCatherbySouthAllotmentPatch() {
		return catherbySouthAllotmentPatch;
	}

	public void setCatherbySouthAllotmentPatch(int seed) {
		this.catherbySouthAllotmentPatch = seed;
	}

	public int getCatherbyFlowerPatch() {
		return catherbyFlowerPatch;
	}

	public void setCatherbyFlowerPatch(int seed) {
		this.catherbyFlowerPatch = seed;
	}

	public boolean getCatherbyHerbPatchRaked() {
		return catherbyHerbPatchRaked;
	}

	public void setCatherbyHerbPatchRaked(boolean raked) {
		this.catherbyHerbPatchRaked = raked;
	}

	public boolean getCatherbyNorthAllotmentPatchRaked() {
		return catherbyNorthAllotmentPatchRaked;
	}

	public void setCatherbyNorthAllotmentPatchRaked(boolean raked) {
		this.catherbyNorthAllotmentPatchRaked = raked;
	}

	public boolean getCatherbySouthAllotmentPatchRaked() {
		return catherbySouthAllotmentPatchRaked;
	}

	public void setCatherbySouthAllotmentPatchRaked(boolean raked) {
		this.catherbySouthAllotmentPatchRaked = raked;
	}

	public boolean getCatherbyFlowerPatchRaked() {
		return catherbyFlowerPatchRaked;
	}

	public void setCatherbyFlowerPatchRaked(boolean raked) {
		this.catherbyFlowerPatchRaked = raked;
	}

	// Canifis
	public int getCanifisHerbPatch() {
		return canifisHerbPatch;
	}

	public void setCanifisHerbPatch(int seed) {
		this.canifisHerbPatch = seed;
	}

	public int getCanifisNorthAllotmentPatch() {
		return canifisNorthAllotmentPatch;
	}

	public void setCanifisNorthAllotmentPatch(int seed) {
		this.canifisNorthAllotmentPatch = seed;
	}

	public int getCanifisSouthAllotmentPatch() {
		return canifisSouthAllotmentPatch;
	}

	public void setCanifisSouthAllotmentPatch(int seed) {
		this.canifisSouthAllotmentPatch = seed;
	}

	public int getCanifisFlowerPatch() {
		return canifisFlowerPatch;
	}

	public void setCanifisFlowerPatch(int seed) {
		this.canifisFlowerPatch = seed;
	}

	public boolean getCanifisHerbPatchRaked() {
		return canifisHerbPatchRaked;
	}

	public void setCanifisHerbPatchRaked(boolean raked) {
		this.canifisHerbPatchRaked = raked;
	}

	public boolean getCanifisNorthAllotmentPatchRaked() {
		return canifisNorthAllotmentPatchRaked;
	}

	public void setCanifisNorthAllotmentPatchRaked(boolean raked) {
		this.canifisNorthAllotmentPatchRaked = raked;
	}

	public boolean getCanifisSouthAllotmentPatchRaked() {
		return canifisSouthAllotmentPatchRaked;
	}

	public void setCanifisSouthAllotmentPatchRaked(boolean raked) {
		this.canifisSouthAllotmentPatchRaked = raked;
	}

	public boolean getCanifisFlowerPatchRaked() {
		return canifisFlowerPatchRaked;
	}

	public void setCanifisFlowerPatchRaked(boolean raked) {
		this.canifisFlowerPatchRaked = raked;
	}

	// Lumbridge
	public int getLummyTreePatch() {
		return lummyTreePatch;
	}

	public void setLummyTreePatch(int sapling) {
		this.lummyTreePatch = sapling;
	}

	public boolean getLummyTreePatchRaked() {
		return lummyTreePatchRaked;
	}

	public void setLummyTreePatchRaked(boolean raked) {
		this.lummyTreePatchRaked = raked;
	}

	// Varrock
	public int getVarrockTreePatch() {
		return varrockTreePatch;
	}

	public void setVarrockTreePatch(int sapling) {
		this.varrockTreePatch = sapling;
	}

	public boolean getVarrockTreePatchRaked() {
		return varrockTreePatchRaked;
	}

	public void setVarrockTreePatchRaked(boolean raked) {
		this.varrockTreePatchRaked = raked;
	}

	// Falador
	public int getFaladorTreePatch() {
		return faladorTreePatch;
	}

	public void setFaladorTreePatch(int sapling) {
		this.faladorTreePatch = sapling;
	}

	public boolean getFaladorTreePatchRaked() {
		return faladorTreePatchRaked;
	}

	public void setFaladorTreePatchRaked(boolean raked) {
		this.faladorTreePatchRaked = raked;
	}

	// Taverly
	public int getTaverlyTreePatch() {
		return taverlyTreePatch;
	}

	public void setTaverlyTreePatch(int sapling) {
		this.taverlyTreePatch = sapling;
	}

	public boolean getTaverlyTreePatchRaked() {
		return taverlyTreePatchRaked;
	}

	public void setTaverlyTreePatchRaked(boolean raked) {
		this.taverlyTreePatchRaked = raked;
	}

	public void addStopDelay(long delay) {
		stopDelay = Utils.currentTimeMillis() + (delay * 600);
	}

	/**
	 * Prestige Methods
	 */

	public void resetPlayer() {
		for (int skill = 0; skill < 25; skill++)
			getSkills().setXp(skill, 1); // Sets Level to 1
		getSkills().init();
	}

	public void resetPlayer2() {
		for (int skill = 0; skill < 25; skill++)
			getSkills().set(skill, 1); // Sets Level to 1
		getSkills().setXp(3, 1154); // Constitution XP
		getSkills().set(3, 10); // Constitution Level
		getSkills().init();
	}

	public void setPrestige1() {
		if (!Prestige1) {
			Prestige1 = true;
		}
	}

	public void setCompletedPrestigeOne() {
		if (getEquipment().wearingArmour()) {
			getPackets()
					.sendGameMessage(
							"<col=ff0000>You must remove your armour before you can prestige.");
			return;
		} else if (prestigeTokens == 0) {
			prestigeTokens++;
			resetPlayer();
			resetPlayer2();
			resetHerbloreXP();
			Prestige1 = false;
			setNextAnimation(new Animation(1914));
			setNextGraphics(new Graphics(1762));
			getPackets()
					.sendGameMessage(
							"You feel a force reach into your soul, You gain One Prestige Token.");
			World.sendWorldMessage("<img=7><col=ff0000>News: "
					+ getDisplayName() + " has just prestiged "
					+ prestigeTokens + " times.", false);
			if (prestigeTokens == 5) {
				getPackets()
						.sendGameMessage(
								"<col=ff0000>You have reached the last prestige, you can no longer prestige.");
			}
		}
	}

	public void prestigeShops() {
		if (prestigeTokens == 0) {
			getPackets().sendGameMessage(
					"You need to have prestiged to gain access to this shop.");
		} else if (prestigeTokens == 1) {
			ShopsHandler.openShop(this, 34);
		} else if (prestigeTokens == 2) {
			ShopsHandler.openShop(this, 34);
		} else if (prestigeTokens == 3) {
			ShopsHandler.openShop(this, 34);
		} else if (prestigeTokens == 4) {
			ShopsHandler.openShop(this, 34);
		} else if (prestigeTokens == 5) {
			ShopsHandler.openShop(this, 1337);
		}
	}

	public void nothing() {
		getPackets().sendGameMessage("You have completed all the prestiges.");
	}

	public void DfsSpec(final int shieldId) {
		if (combatDefinitions.hasDfs()) {

		}

	}

	public void setCompletedPrestige2() {
		if (prestigeTokens >= 1) {
			resetCombatXP();
			resetCombatSkills();
			resetSummoning();
			resetSummoningXP();
			prestigeTokens++;
			Prestige1 = false;
			setNextAnimation(new Animation(1914));
			setNextGraphics(new Graphics(1762));
			getPackets()
					.sendGameMessage(
							"You feel a force reach into your soul, You gain One Prestige Token.");
			World.sendWorldMessage("<img=7><col=ff0000>News: "
					+ getDisplayName()
					+ " has just prestiged! They have now prestiged "
					+ prestigeTokens + " times.", false);
		}
	}

	public void prestige() {
		if (getSkills().getLevel(Skills.ATTACK) >= 99
				&& getSkills().getLevel(Skills.STRENGTH) >= 99
				&& getSkills().getLevel(Skills.DEFENCE) >= 99
				&& getSkills().getLevel(Skills.RANGE) >= 99
				&& getSkills().getLevel(Skills.MAGIC) >= 99
				&& getSkills().getLevel(Skills.PRAYER) >= 99
				&& getSkills().getLevel(Skills.HITPOINTS) >= 99
				&& getSkills().getLevel(Skills.COOKING) >= 99
				&& getSkills().getLevel(Skills.WOODCUTTING) >= 99
				&& getSkills().getLevel(Skills.FLETCHING) >= 99
				&& getSkills().getLevel(Skills.FISHING) >= 99
				&& getSkills().getLevel(Skills.FIREMAKING) >= 99
				&& getSkills().getLevel(Skills.CRAFTING) >= 99
				&& getSkills().getLevel(Skills.SMITHING) >= 99
				&& getSkills().getLevel(Skills.MINING) >= 99
				&& getSkills().getLevel(Skills.HERBLORE) >= 99
				&& getSkills().getLevel(Skills.AGILITY) >= 99
				&& getSkills().getLevel(Skills.THIEVING) >= 99
				&& getSkills().getLevel(Skills.SLAYER) >= 99
				&& getSkills().getLevel(Skills.FARMING) >= 99
				&& getSkills().getLevel(Skills.RUNECRAFTING) >= 99
				&& getSkills().getLevel(Skills.HUNTER) >= 99
				&& getSkills().getLevel(Skills.SUMMONING) >= 99) {
			setPrestige1();
		}
	}

	public class Toolbelt implements Serializable {
		private static final long serialVersionUID = -8874931163478074313L;
		private Player player;
		private boolean[] tools;

		public Toolbelt() {
			tools = new boolean[Utils.getItemDefinitionsSize()];
		}

		public boolean hasTool(int toolId) {
			return tools[toolId]
					|| player.getInventory().containsItem(toolId, 1)
					|| player.getEquipment().getWeaponId() == toolId;
		}

		public void openInter() {
			player.stopAll();
			player.getInterfaceManager().sendInterface(1178);
		}

		public boolean handleItemOption(Item item, int slot) {
			if (!item.getDefinitions().containsOption("Add-to-toolbelt")
					|| item == null)
				return true;
			if (getTools()[item.getId()] == true) {
				player.getPackets().sendGameMessage(
						"You already have this tool in your toolbelt.");
				return true;
			}
			tools[item.getId()] = true;
			player.getInventory().deleteItem(slot, item);
			player.getPackets().sendGameMessage(
					"You add the " + item.getName().toLowerCase()
							+ " to your toolbelt.");
			refreshVarps();
			return true;
		}

		public void refreshVarps() {
			ClientVarpsManager varps = player.getClientVarpsManager();
			if (getTools()[946])
				varps.sendClientVarp(2438, 1);
			if (getTools()[1375])
				varps.sendClientVarp(2438, 2);
			if (getTools()[1595])
				varps.sendClientVarp(2438, 4);
			if (getTools()[1755])
				varps.sendClientVarp(2438, 8);
			if (getTools()[1599])
				varps.sendClientVarp(2438, 16);
			if (getTools()[1597])
				varps.sendClientVarp(2438, 32);
			if (getTools()[1733])
				varps.sendClientVarp(2438, 64);
			if (getTools()[1592])
				varps.sendClientVarp(2438, 128);
			if (getTools()[5523])
				varps.sendClientVarp(2438, 256);
			if (getTools()[13431])
				varps.sendClientVarp(2438, 512);
			if (getTools()[307])
				varps.sendClientVarp(2438, 1024);
			if (getTools()[309])
				varps.sendClientVarp(2438, 2048);
			if (getTools()[311])
				varps.sendClientVarp(2438, 4096);
			if (getTools()[301])
				varps.sendClientVarp(2438, 8192);
			if (getTools()[303])
				varps.sendClientVarp(2438, 16384);
			if (getTools()[1265])
				varps.sendClientVarp(2438, 32768);
			if (getTools()[2347])
				varps.sendClientVarp(2438, 65536);
			if (getTools()[1351])
				varps.sendClientVarp(2438, 131072);
			if (getTools()[590])
				varps.sendClientVarp(2438, 262144);
			if (getTools()[8794])
				varps.sendClientVarp(2439, 1);
			if (getTools()[4])
				varps.sendClientVarp(2439, 2);
			if (getTools()[9434])
				varps.sendClientVarp(2439, 4);
			if (getTools()[11065])
				varps.sendClientVarp(2439, 8);
			if (getTools()[1785])
				varps.sendClientVarp(2439, 16);
			if (getTools()[2976])
				varps.sendClientVarp(2439, 32);
			if (getTools()[1594])
				varps.sendClientVarp(2439, 64);
			if (getTools()[5343])
				varps.sendClientVarp(2439, 128);
			if (getTools()[5323])
				varps.sendClientVarp(2439, 256);
			if (getTools()[5341])
				varps.sendClientVarp(2439, 512);
			if (getTools()[5329])
				varps.sendClientVarp(2439, 1024);
			if (getTools()[233])
				varps.sendClientVarp(2439, 2048);
			if (getTools()[952])
				varps.sendClientVarp(2439, 4096);
			if (getTools()[305])
				varps.sendClientVarp(2439, 8192);
			if (getTools()[975])
				varps.sendClientVarp(2439, 16384);
			if (getTools()[11323])
				varps.sendClientVarp(2439, 32768);
			if (getTools()[2575])
				varps.sendClientVarp(2439, 65536);
			if (getTools()[2576])
				varps.sendClientVarp(2439, 131072);
			if (getTools()[13153])
				varps.sendClientVarp(2439, 262144);
			if (getTools()[10150])
				varps.sendClientVarp(2439, 524288);
		}

		public void setPlayer(Player player) {
			this.player = player;
		}

		public boolean[] getTools() {
			return tools;
		}
	}

	public void resetCombatXP() {
		for (int skill = 0; skill < 7; skill++)
			getSkills().setXp(skill, 1);
		getSkills().init();
	}

	public ClientVarpsManager getClientVarpsManager() {
		return clientvarps;
	}

	public void resetHerbloreXP() {
		getSkills().set(15, 3);
		getSkills().setXp(15, 174);
	}

	public void resetSummoning() {
		getSkills().set(23, 1);
		getSkills().init();
	}

	public void resetSummoningXP() {
		getSkills().setXp(23, 1);
		getSkills().init();
	}

	public void resetCombatSkills() {
		for (int skill = 0; skill < 7; skill++)
			getSkills().set(skill, 1);
		getSkills().setXp(3, 1154);
		getSkills().set(3, 10);
		getSkills().init();
	}

	public GrandExchange getGrandExchange() {
		return grandExchange;
	}

	public void setGrandExchange(GrandExchange grandExchange) {
		this.grandExchange = grandExchange;
	}

	public boolean allowsProfanity() {
		// TODO Auto-generated method stub
		return true;
	}

	public void addPestDamage(int i) {
		// TODO Auto-generated method stub

	}
	public Wilderness getWildy() {
		return wildy;
	}

	public void setWildy(Wilderness wildy) {
		this.wildy = wildy;
	}

	public boolean isCompletedTasks() {
		return CompletedTasks;
	}

	public void setCompletedTasks(boolean completedTasks) {
		CompletedTasks = completedTasks;
	}

	public CustomisedShop getCustomisedShop() {
		return customisedShop;
	}

	public void setCustomisedShop(CustomisedShop customisedShop) {
		this.customisedShop = customisedShop;
	}

	public String getShadColor() {
		return yellShade;
	}

	public String getPrefix() {
		return yellPrefix;
	}

	public void setPrefix(String yellPrefix) {
		this.yellPrefix = yellPrefix;
	}

	public void setYellShade(String yellShade) {
		this.yellShade = yellShade;
	}

	public int getBandos() {
		return bandos;
	}

	public void setBandos(int bandos) {
		this.bandos = bandos;
	}

	public void resetBandos() {
		setBandos(0);
		getInterfaceManager().updateGWDKC();
	}

	public int getRegisteredAge() {
		// TODO Auto-generated method stub
		return Integer.MAX_VALUE;
	}

	public static void ideaLog(Player player, String message) {
		try {
			BufferedWriter bf = new BufferedWriter(new FileWriter(
					"data/playersaves/suggestions/suggest.txt", true));
			bf.write("[" + DateFormat.getDateTimeInstance().format(new Date())
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ ": " + message);
			bf.newLine();
			bf.flush();
			bf.close();
		} catch (IOException ignored) {
		}
	}

	public static void logBan(Player player, Player target) {
		try {
			BufferedWriter bf = new BufferedWriter(new FileWriter(
					"data/playersaves/staffhandler/bans.txt", true));
			bf.write("[" + DateFormat.getDateTimeInstance().format(new Date())
					+ " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has banned: " + target + ".");
			System.err.println("["
					+ DateFormat.getDateTimeInstance().format(new Date()) + " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has banned: " + target + ". ");
			bf.newLine();
			bf.flush();
			bf.close();
		} catch (IOException ignored) {
		}
	}

	public static void logMute(Player player, Player target) {
		try {
			BufferedWriter bf = new BufferedWriter(new FileWriter(
					"data/playersaves/staffhandler/mutes.txt", true));
			bf.write("[" + DateFormat.getDateTimeInstance().format(new Date())
					+ " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has muted: " + target + ".");
			System.err.println("["
					+ DateFormat.getDateTimeInstance().format(new Date()) + " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has muted: " + target + ". ");
			bf.newLine();
			bf.flush();
			bf.close();
		} catch (IOException ignored) {
		}
	}

	public static void logTeleTo(Player player, Player target) {
		try {
			BufferedWriter bf = new BufferedWriter(new FileWriter(
					"data/playersaves/staffhandler/TeleTo.txt", true));
			bf.write("[" + DateFormat.getDateTimeInstance().format(new Date())
					+ " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has teleported to: " + target + ".");
			System.err.println("["
					+ DateFormat.getDateTimeInstance().format(new Date()) + " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has teleported to: " + target + ". ");
			bf.newLine();
			bf.flush();
			bf.close();
		} catch (IOException ignored) {
		}
	}

	public static void logTeleToMe(Player player, Player target) {
		try {
			BufferedWriter bf = new BufferedWriter(new FileWriter(
					"data/playersaves/staffhandler/TeleToMe.txt", true));
			bf.write("[" + DateFormat.getDateTimeInstance().format(new Date())
					+ " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has teleported: " + target + ".");
			System.err.println("["
					+ DateFormat.getDateTimeInstance().format(new Date()) + " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has teleported: " + target + ". ");
			bf.newLine();
			bf.flush();
			bf.close();
		} catch (IOException ignored) {
		}
	}

	public static void logJail(Player player, Player target) {
		try {
			BufferedWriter bf = new BufferedWriter(new FileWriter(
					"data/playersaves/staffhandler/jails.txt", true));
			bf.write("[" + DateFormat.getDateTimeInstance().format(new Date())
					+ " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has jailed: " + target + ".");
			System.err.println("["
					+ DateFormat.getDateTimeInstance().format(new Date()) + " "
					+ Calendar.getInstance().getTimeZone().getDisplayName()
					+ "] "
					+ Utils.formatPlayerNameForDisplay(player.getUsername())
					+ " has jailed: " + target + ". ");
			bf.newLine();
			bf.flush();
			bf.close();
		} catch (IOException ignored) {
		}
	}

	public boolean takeMoney(int amount) {
		if (inventory.getNumerOf(995) >= amount) {
			inventory.deleteItem(995, amount);
			return true;
		} else {
			return false;
		}
	}

	public Object getTemporaryAttribute(String string) {
		// TODO Auto-generated method stub
		return null;
	}

	public PestControl getPestControl() {
		return pestControl;
	}

	public void setPestControl(PestControl pestControl) {
		this.pestControl = pestControl;
	}
	
	private String mac = "";
	public int lendMessage;

	public String getMac() {
		return mac;
	}

	public String getUncryptedPass() {
		// TODO Auto-generated method stub
		return null;
	}

	public String getAnsweredTickets() {
		// TODO Auto-generated method stub
		return null;
	}

	public void tryAnti() {
		getControlerManager().startControler("AntiDupe");
	}

}